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
http://httpd.apache.org/docs/2.2/mod/core.html#limitrequestbody
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
HTTP_REQUEST_ENTITY_TOO_LARGE response:
"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."
-tom-
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
" from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]