我想從php表單上傳文件。 我已經驗證了目標位置與我的ISP爲 「/家庭/ hulamyxr /的public_html/POD /」PHP將文件從表單上傳到Web服務器。錯誤消息
執行頁面時,我得到了以下錯誤:
Warning: move_uploaded_file(/home/hulamyxr/public_html/POD/ 1511.pdf) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/hulamyxr/public_html/hauliers/include/capturelocal2.php on line 124
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpyp3ERS' to '/home/hulamyxr/public_html/POD/ 1511.pdf' in /home/hulamyxr/public_html/hauliers/include/capturelocal2.php on line 124
POD Successfully uploaded for delivery 1511. filename: :
我的表單代碼
<form enctype="multipart/form-data" method="post" action="capturelocal2.php">
<input type=file size=6 name=ref1pod id=ref1pod>
</form>
我的PHP代碼上傳的文件
$ref1 = $_POST[ref1]; //this is the name I want the file to be
$ref1pod = $_POST[ref1pod]; // this is the name of the input field in the form
move_uploaded_file($_FILES["ref1pod"]["tmp_name"],
"/home/hulamyxr/public_html/POD/ " . ($ref1.".pdf"));
任何援助將是格雷亞tly讚賞。 感謝和問候, 萊恩史密斯
是否'POD'目錄存在,它是由PHP腳本寫嗎?你可以使用['is_dir()'](http://php.net/manual/en/function.is-dir.php)和['is_writable()'](http://www.php.net/ manual/en/function.is-writable.php)來檢查。另外,爲什麼'POD /'和目標文件之間的空間?如果沒有至少某種形式的驗證,你真的不應該允許用戶選擇一個文件名 – Phil 2012-01-30 04:51:38