我想将 csv 提要上传到公共 ftp。
我有这个:
global $_CONFIG;
$host = $_CONFIG['po']['ftp']['server'];
$username = $_CONFIG['po']['ftp']['username'];
$password = $_CONFIG['po']['ftp']['password'];
$ftp_path = $_CONFIG['po']['ftp']['upload_path'];
$file = $export_file;
$fp = fopen($export_file, 'r+');
// set up basic connection
$conn_id = ftp_connect($host);
// login with username and password
$login_result = ftp_login($conn_id, $username, $password);
// try to upload $file
if (ftp_fput($conn_id, $ftp_path, $fp, FTP_BINARY)) {
echo "Successfully uploaded $file\n";
exit;
} else {
echo "There was a problem while uploading $file\n";
exit;
}
// close the connection and the file handler
fclose($fp);
ftp_close($conn_id);
主机、用户、密码正确。导出文件是D:/some path .csv
问题是调用了 ftp 服务器上的文件.upload.somefile.csv
(并且它没有完整大小)。
ftp_path 是/somefile.csv
.
我究竟做错了什么?