我正在使用php页面进行FTP上传。
我检查了文件的访问权限,但它是可访问的。有人可以告诉我为什么会这样吗?
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
flush();
$ftp_server = "myserver";
$ftp_user_name="myuser";
$ftp_user_pass="mypass";
$remote_file="myfile.txt";
$file="myfile.txt";
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $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";
}
// close the connection
ftp_close($conn_id);
?>
当我在浏览器中时,它给了我一个警告,如下所示:
Warning: ftp_put(): Access is denied. in /var/www/html/ftpcheck.php on line 17. There was a problem while uploading myfile.txt.
我检查了文件的访问权限,但它是可访问的。有人可以告诉我为什么会这样吗?