httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Donovan <>
Subject Re: [users@httpd] Stopping a form processing if size of file is too big with Apache.
Date Sun, 01 Jul 2007 14:59:40 GMT
Norman Khine wrote:
> Hello,
> I have a POST form into which I allow the user to upload an image file
> png, flash, gif, jpg.
> Is there anything I can do with Apache involving artificially
> stopping the upload after receiving enough bytes to constitute the
> image header, and then deciding whether or not to proceed with the
> upload at that point and if the file does meet the size parameters then
> continue with the upload, if not then just return an error, advising the
> user that the file is too big.
> I don't want to use client-side application as this I think is not the
> right way to do it, plus the fact that it may infringe on the privacy
> i.e. my script reading the size file on the client computer. Maybe I am
> wrong?
> Any one with advise on how others approach this issue?
The LimitRequestBody directive
might do what you need.

It will stop an oversize upload after reading HTTP headers if the client 
includes a Content-Length header with the request.

Even without a Content-Length header it will still stop the request once 
the limit is reached, so users cannot upload oversize files.

For uploads which are too large, Apache returns a 413 

"The requested resource {URI} does not allow request data with {METHOD} 
requests, or the amount of data provided in the request exceeds the 
capacity limit."


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message