根據PHP.net documentation,如果move_uploaded_file
失敗沒有錯誤,這是因爲它無法打開原始文件,但據我可以告訴該文件存在並可被代碼訪問。有誰知道是什麼原因導致了這個問題?move_uploaded_file失敗 - 沒有錯誤信息
這裏的命令:
if(!move_uploaded_file($file["tmp_name"],
SITE_ROOT."/../static/images/photos/tmp/".$fileName.$fileExt)) {
throw new Exception("ERROR: There was a serious server problem uploading the image :(");
} else {
return true;
}
下面是其中$ newImage創建:
if(imagejpeg($img_dst, sys_get_temp_dir()."/tmp.jpg", 100)) {
$newImage["name"] = "tmp.jpg";
$newImage['tmp_name'] = sys_get_temp_dir()."/tmp.jpg";
$newImage['error'] = 0;
$newImage['type'] = "image/jpeg";
$newImage['size'] = filesize(sys_get_temp_dir()."/tmp.jpg");
我甚至可以查看我的系統的臨時目錄中的文件,但即使filesize()
可以看到它罰款,move_uploaded_file
似乎有問題。
日誌文件是空的(除了MIME警告:Cannot get media type from 'x-mapp-php5'
)。任何人都知道發生了什麼事?
編輯:我不知道是否能有一些與此有關? (從文件)。
move_uploaded_file()以只允許那些通過PHP上傳的文件被移動,確保此操作的安全性。
編輯:是的,就是這樣。
唉!我希望我現在可以爲此付出代價 - 我真的需要一些幫助:( – 2013-03-10 22:11:23