我正试图在codeigniter中上传一个500 MB的文件。我的网站托管在IIS7上。我已经在web.config文件中增加了maxAllowedContentLength。我还在php.ini 中增加了upload_max_filesize和post_max_size
当我试图上传一个小于10MB的文件时,它可以正常工作,但当我尝试上传一个大于100MB的文件,它不能正常工作。这是我的代码
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>`
当文件小于10MB时,如果部分运行,但当我尝试上传超过100MB的文件时,则其他部分正在运行。不知道为什么。我已经检查了输入文件的值,但它是空的。
遵循此url CodeIgniter上传大文件
或使用以下代码。
以下代码用于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);
在.htaccess文件中设置以下代码,如果使用IIs服务器,则更改Web.config文件。
请参阅下面的web.confg文件的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参数。
$config['max_size'] = '1000000';
$config['max_width'] = '1024000';
$config['max_height'] = '768000';
然后尝试。