Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File uploading not working for larger files

I am trying to upload a .zip file. It is working well for small files . But I can upload files >2MB. When I try to upload files >2 MB google chrome shows in the bottom left corner as (uploadin : --%) where -- is a no like 10. But it is stuck after 14%. After some time it shows an error like "Error 101 (net::ERR_CONNECTION_RESET): The connection was reset."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>
like image 569
user1467983 Avatar asked Jun 21 '12 14:06

user1467983


People also ask

How can I upload a file that is too large?

You can make a large file a little smaller by compressing it into a zipped folder. In Windows, right-click the file or folder, go down to “send to,” and choose “Compressed (zipped) folder.” This will create a new folder that's smaller than the original.

Can a file be too big to upload to Google Drive?

What Are the File Size Limits of Google Drive? Individual users can upload up to 750GB to Google Drive per day.


2 Answers

Check upload_max_filesize, max_input_time, and post_max_size in your php.ini

If the file size is very large, you may need to bump memory_limit as well.

like image 144
somedev Avatar answered Oct 20 '22 00:10

somedev


change php.ini change size and test your script.(php.ini resides in php installation directory)

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

to

upload_max_filesize = Required_size M
like image 44
Mahesh Meniya Avatar answered Oct 20 '22 01:10

Mahesh Meniya