【发布时间】:2012-03-26 04:39:51
【问题描述】:
我正在尝试将上传的文件移动到远程服务器上,这不起作用;
move_uploaded_file($tmp_name, "uploads/$code1/$code.$fileex");
$ftp_server = "IP";
$ftp_user_name = "username";
$ftp_user_pass = "password";
$file = $tmp_name;
$remote_file = "/public_html/test/uploads/";
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// upload a file
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";
}
// close the connection
ftp_close($conn_id);
我得到了这个错误;
警告:ftp_put() [function.ftp-put]:无法打开该文件:是第 52 行 /home/file/public_html/uploaded.php 中的目录
【问题讨论】: