DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=22633>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=22633 Document how to use web.xml "maxFileSize" and how to deal with "MaxLengthExceededException" ------- Additional Comments From [EMAIL PROTECTED] 2004-09-01 15:44 ------- You can tell if the maxFileSize has been exceeded by looking for the MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED attribute in the request: if(request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED) != null) { // Throw a fit as the upload was too big. } This is set as soon as the CommonsMultipartRequestHandler detects that the upload is larger than the struts-config.xml maxFileSize: <controller> <set-property property="maxFileSize" value="25M"/> </controller> To do this on a per upload basis you need override the CommonsMultipartRequestHandler.handleRequest() method and manipulate the commons fileupload bits specifically for that request. You need to answer the question of where the RequestHandler is going to get the information that maps that particular request to a maxFileSize though. In my webapp the information is sourced from a DB keyed on other request/session resident data (feels ugly, at least I have a DAO). Note that extending CommonsMultipartRequestHandler is not that simple as a number of the fields are private when they would be more useful as protected (notably the Hashtables that are instantiated in handleRequest()). I got around this by copying and modifying the CommonsMultipartRequestHandler then extending that for the per upload tests. I'll get around to submitting a patch at some point. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]