I've been known to be wrong before ;) unfortunately, more often than I would prefer :(
The next setting I would look at is in commons-fileupload, but with the stock file upload capabilities, you don't have a lot of options for changing configuration. I didn't look really close at how CFU behaves, but if you came back and said that it waits until the upload is complete before checking file size, I wouldn't be surprised. IIRC, the content size sent by the browser as part of the upload is not always reliable, leaving the upload handler to check size as it is receiving data. IMO, it might be hard to make it work right. Fortunately, there is a plugin in the sandbox that makes the upload capabilities more configurable, but unfortunately, you have to be running against a SNAPSHOT build of struts, since I had to update core to allow some of the configuration. If you wanna play around with it, since it's unreleased, be prepared to build struts and the plugin from scratch with maven and be patient if you find bugs. On Mon, Jun 15, 2009 at 9:31 AM, Greg Lindholm<greg.lindh...@gmail.com> wrote: > > > On Sun, Jun 14, 2009 at 1:49 AM, Wes Wannemacher <w...@wantii.com> wrote: >> >> On Saturday 13 June 2009 10:34:53 pm tatan123 wrote: >> > We want to restrict the file upload size to 2 MB. While doing testing it >> > seems we can upload a 100 MB file, after that struts2 showing message >> > that >> > the uploaded file exceeds the max file size limit. Is there any way >> > struts2 >> > can show the error message without full file upload... >> > >> > Thanks >> >> I could be wrong, but if you are talking about the temp file generated as >> the >> upload takes place, then you might be better off setting the max post size >> of >> your application server. In Tomcat, you can use the maxPostSize attribute >> of >> the connector element. >> >> -Wes >> -- >> >> > > I don't think the Tomcat maxPostSize attribute applies to file uploads. > Here is what the Tomcat 5.5 docs say: > > The maximum size in bytes of the POST which will be handled by the container > FORM URL parameter parsing. The limit can be disabled by setting this > attribute to a value less than or equal to 0. If not specified, this > attribute is set to 2097152 (2 megabytes). > > I've never set this attribute and have been able to upload 20mb files. > > -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org