我正在使用php的簡單文件上傳功能。PHP file_exist工作不正常?
我用This功能上傳三個文件:
而且這裏是我存儲我的文件,我的目錄內在張力結構:
ROOT-
-notes-
-demo-
-demo_file1.jpg
-main-
-main_file1.jpg
-thumb-
-manage.php //file which handle uploading code
我打電話這樣的上傳功能:
$demo_path="notes\demo";
list($demo_file_name,$error)=upload('demo_file',$demo_path,'pdf');
if($error!=""){
echo 'error-demo'.$error;
exit;
}
//uploading main file
$main_path="notes\main";
list($file_name,$error)=upload('main_file',$main_path,'pdf');
if($error!=""){
echo 'error-main'.$error;
exit;
}
//uploadnig thumbnail
$thumb_path="notes\thumb";
list($thumb_file_name,$error)=upload('file_thumb',$thumb_path,'jpg,gif,jpeg,png');
if($error!=""){
echo 'error-thumb'.$error;
exit;
}
此代碼對於演示文件和主文件工作正常,但給予拇指錯誤說
error-thumb無法上載文件{文件名}:文件夾不存在。
請你幫我弄清楚問題嗎?
在此先感謝。
注意:$ _FILES顯示所有三個文件。
你在哪裏,即使使用'file_exists()'爲你的標題所暗示? –
@ØHankyPankyØ有一個至少在鏈接,OP提到... – BlitZ
所以不是錯誤信息非常清楚,該文件夾,你試圖上傳這個文件,不存在? –