Re: [請益]關於上傳

看板PHP作者 (饒輝)時間17年前 (2008/08/28 17:03), 編輯推噓3(303)
留言6則, 2人參與, 最新討論串2/2 (看更多)
※ 引述《chobitsppc (無止盡的道路)》之銘言: 可以從這邊找到答案: http://tw.php.net/manual/en/function.is-uploaded-file.php if (is_uploaded_file($userfile)) { //include code to copy tmp file to final location here... }else{ switch($HTTP_POST_FILES['userfile']['error']){ case 0: //no error; possible file attack! echo "There was a problem with your upload."; break; case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini echo "The file you are trying to upload is too big."; break; case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was //specified in the html form echo "The file you are trying to upload is too big."; break; case 3: //uploaded file was only partially uploaded echo "The file you are trying upload was only partially uploaded."; break; case 4: //no file was uploaded echo "You must select an image for upload."; break; default: //a default error, just in case! :) echo "There was a problem with your upload."; break; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.222.26.129

08/28 17:17, , 1F
感謝warke大的回答,我印出的結果是
08/28 17:17, 1F

08/28 17:17, , 2F
There was a problem with your upload
08/28 17:17, 2F

08/28 17:19, , 3F
原文的意思是可能檔案有問題嗎?
08/28 17:19, 3F

08/28 18:13, , 4F
應該是 enctype="multipart/form-data",上一篇有錯
08/28 18:13, 4F

08/28 19:11, , 5F
感謝allen501pc~有時候真的是會鬼打牆啊...囧rz
08/28 19:11, 5F

08/28 20:57, , 6F
不客氣。
08/28 20:57, 6F
文章代碼(AID): #18jcdt3h (PHP)
討論串 (同標題文章)
文章代碼(AID): #18jcdt3h (PHP)