PHP文件传输脚本.几乎完成了



有人能弄清楚这是不工作吗?我一直在尝试不同的事情,双重检查语法等,但我得到的错误信息,我已经设置为当一个文件不传输。这是我的第一个PHP脚本。

感谢您的帮助,我将在此期间做研究。

使用NetBeans

<?php
$user = "username";
$password = "password";
$server_file = 'mag_hounddog.mp3';
$local_file = 'C:userskazuimandesktopmag_hounddog.mp3';
$ftp_server = "ftp.mysite.com";
// setup a basic connection to the ftp server
$connectionID = ftp_connect($ftp_server) or die("Connection was Not Successful");
// login with username and password for your account
$loginResult = ftp_login($connectionID, $user, $password);
echo ftp_pwd($connectionID);
// changes the directory to the tvstation you can hard code one in here.
if (ftp_chdir($connectionID, "test1nbiiwcdp_apps/tv2beta/streams/_definst_/")) {
    echo "Current Directory is Now..." . ftp_pwd($connectionID) . "n";
} else {
    echo "Error Changing Directory .. perhaps it doesn't exist?";
}
// Now to download the files and put them onto your local machine
if (ftp_get($connectionID, $local_file, $remote_file, FTP_BINARY)) {
    echo "Succesfully written $server_file to $local_filen";
} else {
    echo "There was a problem with the FTP transfer please check scriptn";
}
// close the connection
ftp_close($connectionID)
?>

您从未定义过变量$remote_file

在你的序言中,它被称为$server_file

这是一个复制粘贴错误吗?

最新更新