2013-07-21 145 views
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 

回答

0

這可能是因爲權限的問題。目錄「uploads」必須具有寫入權限才能上傳到該目錄。

轉到您的控制面板和設置目錄權限爲777

我希望這將解決您的問題。

+0

我想'755'就夠了嗎? – bystwn22

+0

是的755也夠了。 –