我有一個文件輸入是一個數組,但我以前不再工作,它似乎爲多個文件拋出一個錯誤,它只是上傳最新的文件,我不能指望我們什麼我做錯了:(上傳多個文件數組錯誤
<input type="file" name="userfile[]" id="userfile" class="multi" />
然後在我的控制器:
$upload_files = $_FILES;
var_dump($upload_files['userfile']['name']);
// get the selected files out of the array
for($i = 0; $i < count($upload_files['userfile']['name']); $i++) {
$_FILES['userfile'] = array(
'name' => $upload_files['userfile']['name'][$i],
'type' => $upload_files['userfile']['type'][$i],
'tmp_name' => $upload_files['userfile']['tmp_name'][$i],
'error' => $upload_files['userfile']['error'][$i],
'size' => $upload_files['userfile']['size'][$i]
);
我相信文件的陣列西港島線是'$ _FILES [ 'userfile的' ]'not'$ _FILES ['userfile'] ['name']' – Dale 2012-04-19 12:05:50
所以在你的情況下:'$ upload_files ['userfile']' – Dale 2012-04-19 12:06:54
試試這個鏈接 http://www.codeproject.com/Articles/ 19606/Javascript的PHP-多文件-U pload – chhameed 2012-04-19 12:18:08