![](/img/trans.png)
[英]Multiple file upload in each inputs using CodeIgniter and Ajax with multiple input field
[英]codeigniter multiple file upload at once using a single input field
我在使用单个输入字段一次上传多个文件时遇到问题,
我的 HTML 表格看起来像这样
<form method="post" action="upload.php" enctype="multipart/form-data">
<input type="file" name="files[]" multiple/>
<input type="submit" />
</form>
在我的 controller 我这样检查
echo "<pre>; print_r($_FILES); die;
当我 select 2 pdf 文件时,我得到 output 像这样
Array ( [files] => Array ( [name] => Array ( [0] => myfile.pdf ) [type] => Array ( [0] => ) [tmp_name] => Array ( [0] => ) [error] => Array ( [0] => 1 ) [size] => Array ( [0] => 0 ) ) )
我应该在 output 中获得 2 个数组,对吗? 那么,这里有什么问题呢?
在您的 controller 中尝试以下代码:
echo "<pre>";
$_FILES['files']; // change over here
die();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.