I am trying to upload a csv file to my ftp server -
$file = 'abc.csv';
$remote_file = 'orders/abc.csv';
$ftp_server = "myserver.com";
$conn_id = ftp_connect($ftp_server, 34261);
ftp_pasv($conn_id, false);
$login_result = ftp_login($conn_id, "myorders", 'pwd');
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file
";
} else {
echo "There was a problem while uploading $file
";
}
ftp_close($conn_id);
But, file doesn't get transferred. Destination folder has read write permissions. Also, I have checked with FTP_ASCII
and FTP_BINARY
methods. abc.txt is in my project's root folder. But I cannot able to track the exact error. How should I debug the code?
Any help is appreciated.
Thanks.