I am using php to upload a file to an ftp server. I can establish a connection and it appears the file is being uploaded. However when I look at the file on the destination server, the file is 0 bytes. Here is the code I am using:
// variables
$ftp_server = ‘www.ftp-fileserver.com’;
$ftp_user_name = ‘username’;
$ftp_user_pass = ‘userpassword’;
$sourcefile = ‘c:foldernamefilename.gif’;
$destination_file = ‘filename.gif’;
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result))
{
echo “FTP connection has failed!”;
echo “Attempted to connect to $ftp_server for user $ftp_user_name”;
exit;
} else {
echo “Connected to $ftp_server, for user $ftp_user_name”;
}
// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
Any help for this rookie is greatly appreciated.
Bob McP