【问题标题】:Upload a file 500 MB in codeigniter IIS7在 codeigniter IIS7 中上传一个 500 MB 的文件
【发布时间】:2015-09-13 16:10:06
【问题描述】:

我正在尝试在 codeigniter 中上传 500 MB 的文件。我的网站托管在 IIS7 上。 我已经在 web.config 文件中增加了 maxAllowedContentLength。 我还在 php.ini 中增加了 upload_max_filesize 和 post_max_size

当我尝试上传小于 10 MB 的文件时,它可以正常工作,但是当我尝试上传大于 100 MB 的文件时,它无法正常工作,这是我的代码

if( ! empty($_FILES['filename']['name'])){ do some action } else{ do other things }

html 表单 `

                    <div class="par control-group">
                        <label class="control-label" for="firstname">Upload New CSV</label>
                        <div class="controls"><input type="file" name="filename" id="filename" class="required input-large" style="width: 50%;"></div>
                    </div>  

                    <input name="umar" type="hidden" value="1">                     
                    <p class="stdformbutton">
                        <button class="btn btn-primary">Save</button>
                    </p>
                </form>`

当文件小于 10 MB 时,如果部分运行,但当我尝试上传超过 100 MB 的文件时,则其他部分正在运行。不知道为什么。我检查了输入文件的值,但它是空的。

【问题讨论】:

  • $_FILES 中有一个 ['error'] 参数是有原因的 - 检查一下。
  • 更改后是否重启了 IIS?
  • 同时显示 html 表单
  • 是的,我已经重启了
  • 这是我的表单 html

标签: php codeigniter iis-7


【解决方案1】:

关注这个网址CodeIgniter Uploading Large Files

或使用下面的代码。

以下代码在您的 php 文件中使用。

ini_set( 'memory_limit', '500M' );
ini_set('upload_max_filesize', '500M');  
ini_set('post_max_size', '500M');  
ini_set('max_input_time', 3600);  
ini_set('max_execution_time', 3600);

如果您使用 IIs 服务器,请在 .htaccess 文件中设置以下代码,然后更改 Web.config 文件。

请参阅下面的 web.conifg 文件 url

http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/translate-htaccess-content-to-iis-webconfig

php_value upload_max_filesize 500M  
php_value post_max_size 500M  
php_value max_input_time 3600  
php_value max_execution_time 3600

评论后编辑我的答案

更新答案

在你的 stage1 函数中设置配置参数。

$config['max_size'] = '1000000';
$config['max_width']  = '1024000';
$config['max_height']  = '768000';

之后再试试吧。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-10
    • 2020-07-17
    • 1970-01-01
    • 2012-01-12
    • 2013-12-05
    • 1970-01-01
    相关资源
    最近更新 更多