0

我有一个 php 脚本,我用它来上传。在我切换到另一台服务器之前,但现在它没有。这是 PHP 文件:

<?php
if($_FILES["file"]["error"] > 0){
    echo "There was an error processing your upload. Please try again. ";
}else{
    // Save this file in the directory
    move_uploaded_file('$_FILES["file"]["tmp_name"]', '"uploads/".$_FILES["file"]["name"]');
}
?>

我不仅在error.log中收到此错误:

[Sun Jul 21 12:32:34 2013] [error] [client 10.127.2.10] PHP Warning:  

move_uploaded_file(uploads/file.
txt): failed to open stream: Permission denied in /home/liongold/Web/upload_script.php on line 6, referer
: http://url/upload_page.html
[Sun Jul 21 12:32:34 2013] [error] [client 10.127.2.10] PHP Warning:  move_uploaded_file(): Unable to mov
e '/tmp/phpa0hsMc' to 'uploads/file.txt' in /home/liongold/Web/upload_script.php on line 6, referer: h
ttp://url/upload_page.html
4

1 回答 1

0

这可能是因为权限问题。目录“上传”必须具有写入权限才能上传到该目录。

转到您的控制面板并将目录权限设置为 777。

我希望它能解决你的问题。

于 2013-07-21T12:51:41.010 回答