我有這樣的代碼我上傳的文件移動到一個特定的目錄:move_uploaded_file()以未能打開流由於無效的參數 - PHP
if (isset($_FILES["image"]["name"])){
if (!is_dir('pf/' . $uid)) {
mkdir('pf/' . $uid);
$large_image_location = "pf/" . $uid;
}else {
$large_image_location = "pf/" . $uid;
}
chmod ($large_image_location, 0777);
move_uploaded_file("$userfile_tmp", "$large_image_location/$userfile_tmp");
}
不過是提供了以下錯誤:
(!) Warning: move_uploaded_file(pf/BfyhieniKJGGqTNm/C:\wamp\tmp\phpF08A.tmp) [function.move-uploaded-file]: failed to open stream: Invalid argument in C:\wamp\www\mingle\upload_dp.php on line 26
如何解決這個問題的任何幫助將不勝感激!
源文件的路徑肯定是錯誤的......看看它......「pf/BfyhieniKJGGqTNm/C:\ wamp \ tmp \ phpF08A.tmp」 –
'$ userfile_tmp'的值是什麼?嘗試在'move_uploaded_file()'之前添加'var_dump($ userfile_tmp)'並提供輸出。 –
@BenediktOlek你已經在錯誤我的朋友... –