File Size problem on Upload

Ask a Question related to MySQL, Design and Development.

  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. Similar Questions and Discussions

    1. File upload size restricted
      Using contribute 3 on a Mac ive tested attaching pdfs of various sizes anything under 2mb works but over produces this error message "Contribute...
    2. can i reduce file size after upload ???
      Hi well - i forgot to mention the option in the previus topic - once the user upload the file to the server is it possible to manipulate the file...
    3. CFILE: How Can I restrict Upload File Size?
      I am using CF 5 and would like to restrict the file size when using <CFILE Action="Upload">. Is there an easy way to do this?
    4. Upload file size
      Hi, Has anyone come across this problem before? I have an upload form that accepts only .rtf files. As soon as the file gets larger than about 1Mb I...
    5. Limiting upload file size!
      Hi, I am using PERSIST upload which uploads an Image in a multipart form. Is it possible to display an error message and not sumbit an image that...
  3. #2

    Default Re: File Size problem on Upload

    [email]garry.jones@morack.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

  4. #3

    Default Re: File Size problem on Upload

    Geoff Muldoon <geoff.muldoon@trap.gmail.com> wrote:
    > [email]garry.jones@morack.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

Posting Permissions

  • You may not post new threads
  • You may 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