Ask a Question related to MySQL, Design and Development.
-
Garry Jones #1
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
-
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... -
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... -
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? -
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... -
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... -
Geoff Muldoon #2
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.Check both your php.ini file and your apache httpd.conf file for settings> I would appreciate if someone could point me in the right direction to
> correct this problem. Where am I going wrong?
which will limit the maximum size of uploaded files.
GM
Geoff Muldoon Guest
-
Axel Schwenke #3
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.Also MySQL has a limit on the size of a query string, this is the> Check both your php.ini file and your apache httpd.conf file for settings
> which will limit the maximum size of uploaded files.
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



Reply With Quote

