ftp_put() returns false when transfer was successful

Hi,

I am getting the following warning message when trying to use ftp_put():

Warning: ftp_put(): Transfer OK

This is causing the function to return false, when in fact the file is transferred successfully.

I have Googled this warning message but no one else has ever received it. Where is this warning coming from? Could it be from the FTP Server?

The section of code causing this is:

if ($conn_id = ftp_connect($ftp_server)) {
	$log_msg .= "Connected to $ftp_server successfully.\\r\
";
} else {
	$log_msg .= "Failed to connect to $ftp_server.\\r\
";
}

if (ftp_login($conn_id, $ftp_user, $ftp_pass)) {
	$log_msg .= "Authentication with $ftp_server was successful.\\r\
";
} else {
	$log_msg .= "Authentication with $ftp_server failed.\\r\
";
}

$log_msg .= "\\r\
Upload Output file:\\r\
";

if (ftp_put($conn_id, $dst_output_dir."/".$output_file, $src_output_dir."\\\\".$output_file, FTP_BINARY)) {
	$log_msg .= "GOOD: " . $output_file . ".\\r\
";
} else {
	$log_msg .= "BAD: " . $output_file . ".\\r\
";
}

This code used to work ok until I recently moved to uploading to another server, which has FileZilla FTP Server on it. I’m starting to this it is a configuration problem with the ftp server.

Thanks for viewing!

Alex

Tried forcing active and passive and the same result. FTP_BINARY and FTP_ASCII made no difference either.

The code works perfectly on another hosted server running the same version of the FTP Server, but not on this new one. I imagine that narrows it down to the firewall or routers at the hosted server location.

I’m thinking that the firewall in front of the server it doesn’t work on is affecting the FTP responses and PHP is not receiving them correctly so it doesn’t know that the files are being written successfully.

Ya, to me sounds like php either isn’t getting a correct response, or isn’t interpreting the response correctly. If you’re really curious, you could use a packet sniffer and look for for the string ‘Transfer OK’, probably somewhere near a 3 digit number(response code).