Home >Backend Development >PHP Tutorial > 用php控制ftp上传文件有关问题已经简化成最简单的代码了 为什么还是有异常呢?
用php控制ftp上传文件问题已经简化成最简单的代码了 为什么还是有错误呢???
$file = 'aaa.txt';//根目录下的文件
$remote_file = 'aaa1.txt';//远程文件
$conn_id = ftp_connect($server);
$login_result = ftp_login($conn_id,$username,$password);
ftp_pasv($conn_id, true);
if (ftp_put($conn_id, $remote_file, $file, FTP_BINARY,0)) {
echo "successfully uploaded $file\n";
}
else {
echo "There was a problem while uploading $file\n";
}
ftp_close($conn_id);
//错误信息:Warning: ftp_put() [function.ftp-put]: aaa.txt: Access is denied. in D:\Program Files\appserv\www\wx\ftp.php on line 63
There was a problem while uploading aaa.txt
------解决方案--------------------
Access is denied
访问被拒绝。
------解决方案--------------------
aaa.txt 改改这个文件的权限。使之可读、可写、可......
------解决方案--------------------
ftp_put 有同名覆盖的功能吗? 映像中没有
------解决方案--------------------
Warning: ftp_put() [function.ftp-put]: aaa.txt: Access is denied. 权限问题
------解决方案--------------------
很明显,木有参加人大代表发言的权利