我有一个文件输入,它是一个数组,但我以前不再工作,它似乎对多个文件抛出错误,它只是上传最新的文件。我无法弄清楚我做错了什么。
<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]
);