-1
代碼:文件上傳
$file = '/export/clients.xml';
$remote_file = '/clients.xml';
$ftp_server = "ftp://my.address.com";
$ftp_user_name = "user";
$ftp_user_pass = "password";
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
ftp_close($conn_id);
現在原始文件路徑爲:ftp://[email protected]/domains/website.com/public_html/export/clients.xml
我應該怎麼寫的文件路徑,以便它可以完成文件傳輸?我希望將文件複製到我的FTP服務器的根目錄中。但是這種方式不起作用。