我一直在使用自動上傳HTML5/JS的圖像文件,並使用PHP腳本將其保存在本地主機(在/ var/WWW /),但我不能保存。當_FILES對象中存在對象時,函數move_uploaded_file總是返回false。我是一個新手在PHP中:如何將上傳的文件保存在本地主機上?
$target = "upload/";
if(!empty($_FILES))
{
if(move_uploaded_file($_FILES['image_file']['tmp_name'], $target))
{
echo "The file ". basename($_FILES['image_file']['name']). " has been uploaded...";
}
else {
echo "Sorry, there was a problem uploading your file. {$error}";
}
}
else
{
echo "_files is empty";
}
轉! – 2011-12-17 13:32:06
問題是move_uploaded_file的第二個參數 - 見我的回答 – SlavaNov 2011-12-17 13:36:18
可能已經閱讀move_uploaded_file的文檔... :) – Corbin 2011-12-17 13:51:13