PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I just use this code to upload a file from my remote machine($source_file ) to the specific server.
But this code is ok upto the $login_result .
When it execute the function ftp_put it gives the "Error";
Give me a suggestion regarding the error message..
<?php
$server = 'SERVER_NAME'; //changed for this example
$user = 'USER_NAME'; //changed for this example
$pass = 'PAEEWORD'; //changed for this example
$source_file = 'E:FOLDER:FILE_NAME';
$destination_file ='DESTINATION_FOLDER';
// set up basic connection
$conn_id=ftp_connect($server);
//echo ftp_pwd($conn_id);
// login with username and password
$login_result = ftp_login($conn_id, $user, $pass);
$abc=ftp_put($conn_id, $destination_file, $source_file, FTP_ASCII) or die("Error");
// close the connection
ftp_close($conn_id);
?>
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
1) No, here the ftp_login is the php in-built function. which is used to ftp login with a server.
2) I want to use FTP file/ Folder Uploading not any HTTP uploading.
3) So i also wanna know wheather is it possible to ftp uploading(file/folder) from a remote
client machine(as C:/documents/img.jpg) to a connected server ?
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
folder??? that's difficile/
try :
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I just use this code to upload a file from my remote machine($source_file ) to the specific server.
But this code is ok upto the $login_result .
When it execute the function ftp_put it gives the "Error";
Give me a suggestion regarding the error message..
Here the ftp_login is the php in-built function. which is used to ftp login with a server.
I want to use FTP file/ Folder Uploading not any HTTP uploading.
So i also wanna know wheather is it possible to ftp uploading(file/folder) from a remote
client machine(as C:/documents/img.jpg) to a connected server ?
If possible then how?
Can any body post me the exact PHP code ?
<!!----------This is my code ----------------!!!!!!!!>
<?php
$server = 'SERVER_NAME'; //changed for this example
$user = 'USER_NAME'; //changed for this example
$pass = 'PAEEWORD'; //changed for this example
$source_file = 'E:FOLDER:FILE_NAME';
$destination_file ='DESTINATION_FOLDER';
// set up basic connection
$conn_id=ftp_connect($server);
//echo ftp_pwd($conn_id);
// login with username and password
$login_result = ftp_login($conn_id, $user, $pass);
$abc=ftp_put($conn_id, $destination_file, $source_file, FTP_ASCII) or die("Error");
// close the connection
ftp_close($conn_id);
?>
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
<?php
$ftp_server = "ftp.example.com";
$ftp_user = "foo";
$ftp_pass = "bar";
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
echo "Connected as $ftp_user@$ftp_server\n";
} else {
echo "Couldn't connect as $ftp_user\n";
}
?>
But..... is there exist a FTP server on your website Server????
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
<?php
$ftp_server = "ftp.example.com";
$ftp_user = "foo";
$ftp_pass = "bar";
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
echo "Connected as $ftp_user@$ftp_server\n";
} else {
echo "Couldn't connect as $ftp_user\n";
}
?>
Yes when i use your code its ok amd shows me the message "Connected as $ftp_user@$ftp_server\n".
Upto that my code is also ok.. Now when i entire the ftp_put it doesn't work.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]