Page 1 of 1

Max Post Size & Max Upload Size

Posted: Fri Sep 08, 2006 9:09 am
by seodevhead
I have a web application that allows users to upload some pictures from their computer... usually 5-10 pictures max. With the advent of larger megapixel cameras that produce pictures 10+ megabytes, teamed with internet users who don't know how to resample down an image or just plain don't want to... I need to accomodate such large uploads and hence my current PHP Max Post Size limit and Max Upload Size limit aren't high enough.

My question is... Is it relatively safe to increase the Max Post Size to say 100 mb and increase the max upload size to say 80 mb? This is much more than my current 16mb and 4mb respectively. Or should I just increase the limits and not think twice? Thanks for your valued opinions. Take care.

Posted: Fri Sep 08, 2006 1:01 pm
by feyd
Given the right server set up, you could increase the limits to 4GB if you wanted... not that PHP will understand it, but that's a different topic. So, to answer your question, it depends on your server more than it does PHP.

Posted: Fri Sep 08, 2006 1:35 pm
by seodevhead
Hey feyd... I have a dedicated 3.2 ghz Pentium 4 server with 2 GB Ram. After much more research it seems that the biggest problem with increasing these limits is not so much security issues as it is memory issues, as it seems that if say 5+ concurrent users upload big files at the same time, those files must be stored in php's memory and could essentially eat up a chunk of my RAM and slow the other parts of my server, correct?

So with that being said, and with my server specs... in your humble and professional opinion, would you have any heartache with upping max_post_size and max upload size to say 75 and 85 mb respectively? I know very little about how servers perform under different conditions... especially since I will be using GD to resample down the size of the images and also create thumbnails of each. Thanks again for your help and professional advice.

Posted: Fri Sep 08, 2006 1:40 pm
by feyd
The uploading process doesn't eat much, if any memory in PHP. It's GD that will eat all the memory.

My personal setups usually have the sizes set to 1GB or more, quite often.

Just remember that GD will use roughly $size bytes of memory for any given image resource

Code: Select all

$width = ($imagePixelWidth + 3);
$width -= $width % 4;
$size = $imagePixelHeight * $width * 4;

Posted: Fri Sep 08, 2006 1:57 pm
by seodevhead
feyd wrote:My personal setups usually have the sizes set to 1GB or more, quite often.
When you say this... do you mean you set your max post size and max upload size to 1GB+ or are you referring to something else. So it sounds like in your opinion I am good to go ahead and increase my limits to approx 75-100mb with my server specs?

Also, would it be wiser to just change these php config settings using .htaccess in the web applications folder, as opposed to a "global" config change in the php.ini? Thanks for your input feyd... glad to have a pro like you around!

Posted: Fri Sep 08, 2006 2:01 pm
by Luke
seodevhead wrote:Thanks for your input feyd... glad to have a pro like you around!
He is pretty handy, huh? :wink: :lol:

Posted: Fri Sep 08, 2006 2:07 pm
by feyd
seodevhead wrote:When you say this... do you mean you set your max post size and max upload size to 1GB+ or are you referring to something else.
The directives.
seodevhead wrote:So it sounds like in your opinion I am good to go ahead and increase my limits to approx 75-100mb with my server specs?
The server shouldn't bat much of an eye at it unless you have hundreds of concurrent sessions resizing images. Even then, the CPU will be hit more than the memory.
seodevhead wrote:Also, would it be wiser to just change these php config settings using .htaccess in the web applications folder, as opposed to a "global" config change in the php.ini?
I'll often do it per directory for the larger sizes.
seodevhead wrote:Thanks for your input feyd... glad to have a pro like you around!
I'm glad and honored people appreciate my opinion.