我将max_file_uploads设置为200在php.ini中的值,重新启动php.ini并使用30个输入文件进行上传。下面是我的代码:
<form method="POST" enctype="multipart/form-data">
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
... // Total quantity is 30
</form>在我的控制器中,我使用var_dump检测上传数据:
echo '<pre>';
print_r($_FILES['subavatar']['error']);
echo '</pre>';
die;结果是:
[error] => Array
(
[0] => 0
[1] => 4
[2] => 4
[3] => 4
[4] => 4
[5] => 4
[6] => 4
[7] => 4
[8] => 0
[9] => 4
[10] => 4
[11] => 4
[12] => 4
[13] => 4
[14] => 4
[15] => 4
[16] => 4
[17] => 4
[18] => 4
[19] => 4
)只收到20个文件,其中2个文件上传到临时目录。
我怎么了?如何配置以获取更多文件?
一杯啤酒,以供任何帮助:)
对不起我的英语不好!
全码
文件controllers/Upload.php
class Upload extends CI_Controller {
public function index() {
if ($this->input->post()) {
echo '<pre>';
print_r($_FILES['subavatar']['error']);
echo '</pre>';
die;
}
$this->load->view('upload/index');
}
}文件views/upload/index.php
<form method="POST" enctype="multipart/form-data">
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
</form>发布于 2016-10-29 04:37:03
服务器将其限制为20。您可以尝试使用以下内容,在php.ini中只需查找"max_file_uploads“并将其值更改为100。
在max_file_uploads下面添加一行
suhosin.upload.max_uploads=100
例如:
max_file_uploads = 100
suhosin.upload.max_uploads=100不太确定,因为它的工作和确切的解决方案,但你可以尝试这一点。
发布于 2019-06-26 18:03:12
将max_file_uploads on php.ini设置为所需的文件数。
如果它不起作用:
https://stackoverflow.com/questions/40315927
复制相似问题