douxin8383 2015-06-26 16:09
浏览 58
已采纳

在codeigniter IIS7中上传500 MB的文件

I'm trying to upload a 500 MB file in codeigniter. My website is hosted on IIS7. I have already increased maxAllowedContentLength in my web.config file. I have also increased upload_max_filesize and post_max_size in php.ini

When I try to upload a file less than 10 MB then its working fine but when I try to upload a file size more than 100 MB then its not working fine here is my code

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

html form `

                    <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>`

when file is less than 10 MB then if part run but when I try to upload a file more than 100 MB then else part is running. Don't know why. I have checked input file value buts its empty.

  • 写回答

1条回答 默认 最新

  • dongxing2692 2015-06-26 19:57
    关注

    follow this url CodeIgniter Uploading Large Files

    or use below code.

    Below code use in your php file.

    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);
    

    set below code in .htaccess file if you use IIs server the then change Web.config file.

    see below url for web.conifg file

    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
    

    Edit my answer after you comment

    Update answer

    Set config parameter in your stage1 function.

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

    After then try it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 hexo+github部署博客
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?