Unix Technical Forum

File Size problem on Upload

This is a discussion on File Size problem on Upload within the MySQL forums, part of the Database Server Software category; --> I am trying to allow users to upload large ZIP files to a mysql database table. Small zip files ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 08:46 AM
Garry Jones
 
Posts: n/a
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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 08:46 AM
Geoff Muldoon
 
Posts: n/a
Default Re: File Size problem on Upload

garry.jones@morack.se 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 08:46 AM
Axel Schwenke
 
Posts: n/a
Default Re: File Size problem on Upload

Geoff Muldoon <geoff.muldoon@trap.gmail.com> wrote:
> garry.jones@morack.se 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:
http://de.php.net/manual/en/function...-long-data.php

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: http://dev.mysql.com/doc/refman/5.0/en/
MySQL User Forums: http://forums.mysql.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:02 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com