首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >上载多个文件: max_file_uploads无法工作

上载多个文件: max_file_uploads无法工作
EN

Stack Overflow用户
提问于 2016-10-29 04:05:46
回答 2查看 741关注 0票数 0

我将max_file_uploads设置为200php.ini中的值,重新启动php.ini并使用30个输入文件进行上传。下面是我的代码:

代码语言:javascript
复制
<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检测上传数据:

代码语言:javascript
复制
echo '<pre>';
print_r($_FILES['subavatar']['error']);
echo '</pre>';
die;

结果是:

代码语言:javascript
复制
[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

代码语言:javascript
复制
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

代码语言:javascript
复制
<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>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-10-29 04:37:03

服务器将其限制为20。您可以尝试使用以下内容,在php.ini中只需查找"max_file_uploads“并将其值更改为100。

在max_file_uploads下面添加一行

suhosin.upload.max_uploads=100

例如:

代码语言:javascript
复制
max_file_uploads = 100    
suhosin.upload.max_uploads=100

不太确定,因为它的工作和确切的解决方案,但你可以尝试这一点。

票数 0
EN

Stack Overflow用户

发布于 2019-06-26 18:03:12

将max_file_uploads on php.ini设置为所需的文件数。

如果它不起作用:

  1. 确保您正在编辑正确的php.ini
  2. 您必须重新启动服务器。
  3. 尝试在suhosin.upload.max_uploads下添加max_file_uploads下所需的相同数量的文件。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40315927

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档