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 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)