Martin Cooper wrote:
On Thu, 21 Nov 2002, jfc wrote:
Hi,
A few weeks back I posted a message on the struts mailing list to find
out whether or not it was possible to limit the file upload size 'before
its too late'.
(see
http://www.mail-archive.com/[email protected]/msg44209.html)
In other words the struts example file-upload war package did not enable
the interuption of a file upload based on the file's size. It only only
allows one to perform operations on the file once it has been uploaded
to the server.
Which version of Struts are you using?
struts1.1b2
If you are using 1.1b2 or later,
and you haven't explicitly configured a multipart request handler, then
you're already using Commons FileUpload.
right.
One of the first things FileUpload does is check the Content-Length HTTP
header against a configured threshold. If it's too big, the handler won't
go any further, but will throw a FileUploadException instead. Struts
catches that and also aborts processing the request at that point.
What it may boil down to, though, is when the servlet is provided with the
request to process. If the container buffers the entire request before
calling the servlet, then you're going to have to look for a container
solution, rather than a multipart handler solution.
ok. would the tomcat-user list be a good place to ask this question?
However, if the
servlet is called before the request has been received in its entirety,
then FileUpload, and hence Struts, should behave as you want.
Thanks Martin.
--
Martin Cooper
jfc
I want to prevent someone from logging say 10 clients (or even one) and
uploading huge files which would cause the site to crash before the
check for file size is done.
I gather there are some commercial implementations of the functionality
and also some incentivised licences (jason hunter springs to mind) but I
was wondering if this feature is available or will be available in the
near future within the commons package.
Cheers
jfc
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
