0
我得到這個錯誤,我不知道如何清除它。不知道它是否在我的WAMP上,如果有的話,我有兩個ini文件,開發和生產,我應該在哪裏看?關於WAMP的PHP:上傳/創建文件的問題
(!) Warning: move_uploaded_file(uploadedFiles/gal2.jpg): failed to open stream: No such file or directory in C:\wamp\www\fileupload.php on line 20
Call Stack
# Time Memory Function Location
1 0.0007 257960 {main}() ..\fileupload.php:0
2 0.0015 303448 move_uploaded_file () ..\fileupload.php:20
(!) Warning: move_uploaded_file(): Unable to move 'C:\wamp\tmp\php71A.tmp' to 'uploadedFiles/gal2.jpg' in C:\wamp\www\fileupload.php on line 20
Call Stack
# Time Memory Function Location
1 0.0007 257960 {main}() ..\fileupload.php:0
2 0.0015 303448 move_uploaded_file () ..\fileupload.php:20
的代碼如下:
$desiredPath = 'uploadedFiles/';
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
print "Picture Info"."<br>";
print_r($_FILES['picture']);
if (move_uploaded_file($_FILES['picture']['tmp_name'], $desiredPath.$_FILES['picture']['name']))
{
print 'File Upload Successful';
print '<div>';
print '<img width="300px" src="'.$desiredPath.$_FILES['picture']['name'].'">';
print '</div>';
}
else
{
print 'File Upload Failed with error code: '.$_FILES['picture']['error'];
}
}
確保文件夾具有正確的寫入權限。要麼0755或0777.還要確保您的文件夾確實名爲'uploadedFiles'而不是'uploadedfiles'。它在UNIX/LINUX系統上很重要。 –