File upload does not work for large files

I am trying to download a .zip file. It works well for small files. But I can upload files> 2 MB. When I try to upload files> 2 MB google chrome shows in the lower left corner as (uploadin: -%), where - I do not like 10. But it gets stuck after 14%. After a while, the error message "Error 101 (net :: ERR_CONNECTION_RESET): connection was reset" appears. This web page is not available.

Please help me

This is the form code

<form name="addnewitem" id="addnewitem" method="post" enctype="multipart/form-data"> <?php if (($succ==0) && ($message!="")) { echo "<div class='error'>".$message."</div>"; } ?> <?php if ($msg!="") { echo "<div class='success'>".$msg."</div>"; } ?> <?php if ($msg1!="") { echo "<div class='error'>".$msg1."</div>"; } ?> <div class="list-item"> <div class="form"> <h2>Name & Description</h2> <div class="row"> <div class="left"> <label>Item Title:</label> </div> <div class="right"> <input name="listitemname" id="listitemname" type="text" class="input" maxlength="50" value="<?php echo $_POST['listitemname']; ?>" /> <em>Maximum 50 characters</em> </div> </div> <div class="row"> <div class="left"> <label> Item Description: </label></div> <div class="right"> <textarea name="itemdescription" id="itemdescription" cols="10" rows="5"><?php echo $_POST['itemdescription'];?></textarea> <em>Maximum 600 characters</em> </div> </div> </div> <div class="form"> <h2> Item Files & Preview </h2> <div class="row"> <div class="left"> <label> Item Thumbnail: </label> </div> <div class="right"><input type="file" name="thumbnailimage" id="thumbnailimage" class="input" /> <em>JPG or PNG, 80 x 80 Thumbail</em> </div> </div> <div class="row"> <div class="left"> <label> Item Rollover Preview: </label></div> <div class="right"><input type="file" name="rolloverimage" id="rolloverimage" class="input" /> <em>JPG or PNG, 190 x 190 Preview Image</em> </div> </div> <div class="row"> <div class="left"> <label> Screenshot image 1: </label></div> <div class="right"><input type="file" name="themepreview1" id="themepreview1" class="input" /> <em>JPG or PNG, 420 x 420 Image Screenshot ( Required )</em> </div> </div> <div class="row"> <div class="left"> <label> Screenshot image 2: </label></div> <div class="right"><input type="file" name="themepreview2" id="themepreview2" class="input" /> <em>JPG or PNG, 420 x 420 Image Screenshot ( Optional )</em> </div> </div> <div class="row"> <div class="left"> <label> Screenshot image 3: </label></div> <div class="right"><input type="file" name="themepreview3" id="themepreview3" class="input" /> <em>JPG or PNG, 420 x 420 Image Screenshot ( Optional )</em> </div> </div> <div class="row"> <div class="left"> <label> Screenshot image 4: </label></div> <div class="right"><input type="file" name="themepreview4" id="themepreview4" class="input" /> <em>JPG or PNG, 420 x 420 Image Screenshot ( Optional )</em> </div> </div> <div class="row"> <div class="left"> <label> Item Zip File: </label></div> <div class="right"><input type="file" name="itemfile" id="itemfile" class="input" /> <em>.ZIP File Only </em> </div> </div> <div class="row"> <div class="left"> <label>Demo URL:</label> </div> <div class="right"> <input name="demourl" id="demourl" type="text" class="input" value="<?php echo $_POST['demourl']; ?>" /> <em>Enter the www.themepreviewurl.com here for the item Live Preview</em> </div> </div> </div> <div class="form"> <h2> Category & Attributes </h2> <div class="row"> <div class="left"> <label> Category: </label></div> <div class="right"> <?php $getmaincategories = "SELECT category_name,category_id FROM ".$tbl_main_categories." WHERE category_status = 1"; $exec_getmaincategories = mysql_query($getmaincategories); echo "<select name='categoryname' id='categoryname'>"; echo "<option value='' >Select a Category Now</option>"; while($rows_getmaincategories = mysql_fetch_array($exec_getmaincategories)) { $getsubcategories = "SELECT sub_category_name,sub_category_hash FROM ".$tbl_sub_categories." WHERE sub_category_status=1 AND category_id=".$rows_getmaincategories['category_id']; $exec_getsubcategories = mysql_query($getsubcategories); echo "<option disabled='disabled' value='".$rows_getmaincategories['category_id']."'>".$rows_getmaincategories['category_name']."</option>"; while($rows_getsubcategories = mysql_fetch_array($exec_getsubcategories)) { if ($_REQUEST['categoryname'] == $rows_getsubcategories['sub_category_hash']) { echo $selectedvalue = "selected='selected'"; } echo "<option value='".$rows_getsubcategories['sub_category_hash']."' style='padding-right:inherit' $selectedvalue>&nbsp;&nbsp;&nbsp;&nbsp;-".$rows_getsubcategories['sub_category_name']."</option>"; } } echo "</select>"; ?> </div> </div> <div class="row"> <div class="left"> <label> Compatible Browsers:<br /> use 'ctrl' to select multiples </label></div> <div class="right"> <select multiple="multiple" class="select" name="browsercompatiable[]" id="browsercompatiable[]"> <option value="">Select</option> <option value="ie7" <?php if ($_REQUEST['browsercompatiable'] == "ie7") echo "selected='selected'"; ?>>IE7</option> <option value="ie8" <?php if ($_REQUEST['browsercompatiable'] == "ie8") echo "selected='selected'"; ?>>IE8</option> <option value="ie9" <?php if ($_REQUEST['browsercompatiable'] == "ie9") echo "selected='selected'"; ?>>IE9</option> <option value="firefox" <?php if ($_REQUEST['browsercompatiable'] == "firefox") echo "selected='selected'"; ?>>Firefox</option> <option value="safari" <?php if ($_REQUEST['browsercompatiable'] == "safari") echo "selected='selected'"; ?>>Safari</option> <option value="chrome" <?php if ($_REQUEST['browsercompatiable'] == "chrome") echo "selected='selected'"; ?>>Chrome</option> </select> </div> </div> <div class="row"> <div class="left"> <label> Files Includes:<br /> Use 'ctrl' to select multiples </label></div> <div class="right"> <select multiple="multiple" size="5" class="select" name="filesinclude[]" id="filesinclude[]"> <option value="">Select</option> <option value="ie7" <?php if ($_REQUEST['filesinclude'] == "ie7") echo "selected='selected'"; ?>>PSD Files</option> <option value="ie8" <?php if ($_REQUEST['filesinclude'] == "ie8") echo "selected='selected'"; ?>>Documentation</option> <option value="ie9" <?php if ($_REQUEST['filesinclude'] == "ie9") echo "selected='selected'"; ?>>Multiple Layouts</option> <option value="firefox" <?php if ($_REQUEST['filesinclude'] == "firefox") echo "selected='selected'"; ?>>Multiple Colour Options</option> <option value="safari" <?php if ($_REQUEST['filesinclude'] == "safari") echo "selected='selected'"; ?>>Video Help Files</option> <option value="chrome" <?php if ($_REQUEST['filesinclude'] == "chrome") echo "selected='selected'"; ?>>Other</option> </select> </div> </div> <div class="row"> <div class="left"> <label> Columns: </label></div> <div class="right"> <select name="noofcolumns" id="noofcolumns"> <option value="">Select</option> <option value="1" <?php if ($_REQUEST['noofcolumns'] == "1") echo "selected='selected'"; ?>>1</option> <option value="2" <?php if ($_REQUEST['noofcolumns'] == "2") echo "selected='selected'"; ?>>2</option> <option value="3" <?php if ($_REQUEST['noofcolumns'] == "3") echo "selected='selected'"; ?>>3</option> <option value="4" <?php if ($_REQUEST['noofcolumns'] == "4") echo "selected='selected'"; ?>>4</option> <option value="5" <?php if ($_REQUEST['noofcolumns'] == "5") echo "selected='selected'"; ?>>5</option> </select> </div> </div> <div class="row"> <div class="left"> <label> Layout: </label></div> <div class="right"> <select name="layout" id="layout"> <option value="">Select</option> <option value="1" <?php if ($_REQUEST['layout'] == "1") echo "selected='selected'"; ?>>1</option> <option value="2" <?php if ($_REQUEST['layout'] == "2") echo "selected='selected'"; ?>>2</option> <option value="3" <?php if ($_REQUEST['layout'] == "3") echo "selected='selected'"; ?>>3</option> <option value="4" <?php if ($_REQUEST['layout'] == "4") echo "selected='selected'"; ?>>4</option> <option value="5" <?php if ($_REQUEST['layout'] == "5") echo "selected='selected'"; ?>>5</option> </select> <em>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id arcu vitae eros molestie ultricies ut sit amet nisi. Nulla facilisi.</em> </div> </div> </div> <div class="form"> <h2>Tags</h2> <div class="row"> <div class="left"> <label>Tags:</label> </div> <div class="right"> <textarea name="itemtags" id="itemtags" cols="10" rows="5"><?php echo $_POST['itemtags']; ?></textarea> <em>Maximum 50 characteres</em> </div> </div> </div> <div class="botton"> <input name="additem" id="additem" type="submit" value="Upload Now" class="btn" /> </div> </div> </form> 

And I would like to upload> 3MB files in the .zip field shown below

 <div class="right"><input type="file" name="itemfile" id="itemfile" class="input" /> <em>.ZIP File Only </em> </div> 
+4
source share
4 answers

Check upload_max_filesize, max_input_time, and post_max_size in php.ini

If the file size is very large, you may also need to reduce memory_limit.

+5
source

resize the php.ini change and test your script. (php.ini is located in the php installation directory)

 ; Maximum allowed size for uploaded files. upload_max_filesize = 2M 

to

 upload_max_filesize = Required_size M 
+1
source

Please check that your parameter "max_input_time" on your server is not too low, which is probably why PHP disconnects you. Also, this may be a network / network related issue:

 echo ini_get('max_input_time'); 

If you get -1 from this, most likely this is not PHP cutting you off, but something else in the loop. It can be any hardware on the way to your server, but most likely the server itself or something on the server ...

+1
source

For large files, if you do not want to deal with server settings (especially if you use shared hosting or some other hosting that does not give you complete control over the server), one of the possible solutions is to transfer the download to third-party services.

For example, you can take the form of a direct message in Amazon S3 ( http://s3.amazonaws.com/doc/s3-example-code/post/post_sample.html ) or use a service like Filepicker.io

Full disclosure: I work at Filepicker.io, but I want to help people who deal with problems making large file downloads.

0
source

All Articles