Professional Web Applications Themes

File Size problem on Upload - MySQL

I am trying to allow users to upload large ZIP files to a mysql database table. Small zip files of under 1MB work fine, but not zip files of 7MB. I need to allow for ZIP files of up to 350 MB. The function consists of this three parts, the MYQL table, the form on my website and the php code to upload the form. I would appreciate if someone could point me in the right direction to correct this problem. Where am I going wrong? This is format I am using for the field in the MYSQL table. Field=DATA ...

  1. #1

    Default File Size problem on Upload

    I am trying to allow users to upload large ZIP files to a mysql database
    table. Small zip files of under 1MB work fine, but not zip files of 7MB. I
    need to allow for ZIP files of up to 350 MB.

    The function consists of this three parts, the MYQL table, the form on my
    website and the php code to upload the form.

    I would appreciate if someone could point me in the right direction to
    correct this problem. Where am I going wrong?

    This is format I am using for the field in the MYSQL table.

    Field=DATA
    Type=LONGBLOBB
    Lenth=
    Attribute=
    Null=null
    Standard=NULL
    Extra=

    This is the form code:

    <form method="post" action="upload.php" enctype="multipart/form-data">
    Description:<br> <input type="text" name="form_description" size="40">
    <br>File to upload:<br>
    <input type="file" name="form_data" size="40">
    <p><input type="submit" name="submit" value="submit">
    </form>

    This is php code to open and insert the data from the form.

    <?php
    mysql_connect("MY INFO","MY ACCOUNT","MY PASSWORD");
    mysql_select_db("MY DATABASE");
    $data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
    $result=MYSQL_QUERY("INSERT INTO uploads (description,
    data,filename,filesize,filetype) ". "VALUES
    ('$form_description','$data','$form_data_name','$f orm_data_size','$form_data_type')");
    $id= mysql_insert_id();
    print "<p>File ID: <b>$id</b><br>";
    print "<p>File Name: <b>$form_data_name</b><br>";
    print "<p>File Size: <b>$form_data_size</b><br>";
    print "<p>File Type: <b>$form_data_type</b><p>";
    print "To upload another file <a href="MY WEB PAGE"> Click Here</a>";
    ?>

    Thanks for any help in this matter

    Garry Jones
    Sweden


    Garry Jones Guest

  2. #2

    Default Re: File Size problem on Upload

    [email]garry.jonesmorack.se[/email] says...
    > I am trying to allow users to upload large ZIP files to a mysql database
    > table. Small zip files of under 1MB work fine, but not zip files of 7MB. I
    > need to allow for ZIP files of up to 350 MB.
    > I would appreciate if someone could point me in the right direction to
    > correct this problem. Where am I going wrong?
    Check both your php.ini file and your apache httpd.conf file for settings
    which will limit the maximum size of uploaded files.

    GM
    Geoff Muldoon Guest

  3. #3

    Default Re: File Size problem on Upload

    Geoff Muldoon <geoff.muldoontrap.> wrote:
    > [email]garry.jonesmorack.se[/email] says...
    >> I am trying to allow users to upload large ZIP files to a mysql database
    >> table. Small zip files of under 1MB work fine, but not zip files of 7MB. I
    >> need to allow for ZIP files of up to 350 MB.
    > Check both your php.ini file and your apache httpd.conf file for settings
    > which will limit the maximum size of uploaded files.
    Also MySQL has a limit on the size of a query string, this is the
    max_allowed_packet setting of the MySQL server. When using MySQL 4.1
    or later, one can use the mysqli_stmt_send_long_data() function. See:
    [url]http://de.php.net/manual/en/function.mysqli-stmt-send-long-data.php[/url]

    However, no such function exists to *read* big LOBs from the server,
    so max_allowed_packet should be increased anyway.


    BTW:

    1. Allowing huge uploads by users is an invitation for a DOS attack
    (German: "Tod durch Überfütterung").

    2. For web applications it is in most cases better to store LOBs in
    the webservers filesystem than in the database. Web servers are
    specialized in sending big files to the network (man 2 sendfile)

    3. Sending a 100MB LOB to MySQL will temporarily need 100MB memory
    buffers on both client and server. This will *not* scale.


    XL
    --
    Axel Schwenke, Senior Software Developer, MySQL AB

    Online User Manual: [url]http://dev.mysql.com/doc/refman/5.0/en/[/url]
    MySQL User Forums: [url]http://forums.mysql.com/[/url]
    Axel Schwenke Guest

Similar Threads

  1. File upload size restricted
    By StephenatFresh in forum Adobe Dreamweaver & Contribute
    Replies: 0
    Last Post: March 11th, 05:01 AM
  2. can i reduce file size after upload ???
    By cosmits in forum Macromedia ColdFusion
    Replies: 9
    Last Post: June 15th, 06:08 AM
  3. CFILE: How Can I restrict Upload File Size?
    By pnugent in forum Macromedia ColdFusion
    Replies: 4
    Last Post: May 29th, 08:15 PM
  4. Upload file size
    By colesc8 in forum Macromedia ColdFusion
    Replies: 1
    Last Post: April 20th, 02:18 PM
  5. Limiting upload file size!
    By Don Pacino in forum Dreamweaver AppDev
    Replies: 2
    Last Post: March 17th, 02:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139