我有以下语法,我试图将当前本地服务器目录中的文件移动到 FTP 服务器上。
$source = $csv_filename;
$target = fopen("/LocExports/test.csv", "w");
$conn = ftp_connect("ftp.server.co.za") or die("Could not connect");
ftp_login($conn,"username","password");
$upload = ftp_put($conn, $target,$source,FTP_ASCII);
if (!$upload) { echo 'FTP upload failed!'; }
这失败并出现错误The parameter is incorrect
$csv_filename
是我本地服务器上的文件名。它与 php 文件位于同一文件夹中。
我的目的地实际上是:
http://www.server.co.za/kisv2/xmltest/
任何帮助,将不胜感激。
一如既往地感谢,
更新
根据 alex 的建议,这里是更新的语法:
$csv_filename = 'export-2013-06-13 15:19:48.csv';
$source = $csv_filename; //this is a file in the same directory as my php file. full path is... http://www.server.co.za/kisv2/xmltest/export-2013-06-13 15:19:48.csv
$target = '/LocExports/'.$csv_filename; //full path is... ftp://ftp.hulamin.co.za/LocExports/
$conn = ftp_connect("ftp.server.co.za") or die("Could not connect");
ftp_login($conn, "username", "password");
$upload = ftp_put($conn, $target, $source, FTP_ASCII);
if (!$upload) { echo 'FTP upload failed!'; }