Hi have the below syntax:
$source = $csv_filename;
$target = '/locexport/'.$csv_filename;
$conn = ftp_connect("ftp.server.com") or die("Could not connect");
ftp_login($conn, "ftpusername", "ftppassword");
ftp_pasv($conn, false);
$upload = ftp_put($conn, $target, $source, FTP_ASCII);
if (!$upload) { echo 'FTP upload failed!'; }
This script runs with cron jobs every few hours and has worked for months.
it has suddenly stopped working.
echoing $source and $destination shows the correct paths.
error message is:
Warning: ftp_put() [function.ftp-put]: Opening ASCII mode data connection. in /home/shareduser/public_html/export/export.php on line 55
FTP upload failed!
line 55 is:
$upload = ftp_put($conn, $target, $source, FTP_ASCII);
I have tried changing FTP_ASCII to FTP_BINARY but with the same result.
any ides how to troubleshoot this? it is not a permission issue as a manual transfer in Filezilla with the same credentials succeeds.
Thanks and Regards.
You could try to switch to passive mode (set it to true):
ftp_pasv($conn, true);
Maybe something has changed in destination's firewall.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With