Log in

View Full Version : Upload limit in database



lindsaycb
01-14-2011, 06:19 PM
I took over someone else's PHP/MySQL webapp so I'm trying to understand how/why he did things.

We have an upload form for a syllabus. He had the limit at 2 MB. I have upped that to 5 MB. Here's the code.


<form enctype="multipart/form-data" action="uploadSyllabus.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="5242880" />
Send this file: <input name="userfile" type="file" id="userfile" />
<input type="submit" value=" Upload File " />
</form>

However, no files over the size of 2 MB will upload now. I have looked through the uploadSyllabus.php and there's no mention of the 2 MB limit (besides error messages).

The file is uploaded to our web server and the name is stored in the database. Is there a way to limit the upload amount somewhere else? I really figured this would be an easy change but it's proving to me otherwise!

bluewalrus
01-14-2011, 06:21 PM
In the php config the max post upload size i think by default is 2mB there are also some other settings in there. Look at your php.ini file.

lindsaycb
01-14-2011, 06:23 PM
I should mention, I also have another upload form that the limit is 3 MB. I changed that to 20 MB, still didn't take. And it's done the exact same way as the syllabus section.

lindsaycb
01-14-2011, 06:32 PM
I take that back!! The 3 MB file uploader is also not working! Found something 2.5 MB and it's also blocked. Thanks for the info! I didn't know there was a limit on upload size!

bluewalrus
01-14-2011, 07:02 PM
http://php.net/manual/en/ini.core.php

The name is actually "upload_max_filesize".

Schmoopy
01-14-2011, 07:17 PM
Adding on to what bluewalrus said, it may be worthwhile also looking at what value is stored in "post_max_size".

You need this value to be at least equal or greater than the "upload_max_filesize" value, otherwise the file won't upload properly.

lindsaycb
01-14-2011, 07:19 PM
Yep, after doing a quick Google search on the upload_max_filesize, I also asked my IT department to upp both options; just in case.

james438
01-15-2011, 08:47 AM
I do not have much knowledge about database storage limits for other webhost providers, but with my GoDaddy hosting service all databases, no matter the plan, has a storage capacity of 1GB each. With many files being uploaded at 5mb each you may fill up your database quickly before you will need to start on another database.

djr33
01-15-2011, 07:31 PM
That's why file names or IDs should be stored in the database and the files should be stored separately, as files, where there is no limit on the space (at least not as strict a limit as in the database).

timbim
02-08-2011, 04:25 PM
Also asking a database to index files is somewhat cruel and will slow down any queries.