Thanks Laurie! That's a pretty good idea, and quite possibly what we'll do. The problem with it is that the file is sent along with other form parameters, and if I remember correctly, the Content-Length header is the full length of the body of the post, which would include all the text for those parameters as well, making it difficult to tell which portion of that length is the file and which is the other parameters. Hmmm, anybody see a solution to that issue?
On Feb 8, 2008 12:20 PM, Laurie Harper <[EMAIL PROTECTED]> wrote: > Adam Gordon wrote: > > We're using Struts 1.2.9 and the problem we're seeing is that if a user > > tries to upload a file that does not exist or upload a file that exceeds > > the maxFileSize attribute the FormFile object on the ActionForm is null > > and so we cannot distinguish between the two. > > > > We thought about removing the maxFileSize parameter and doing the check > > ourselves in the ActionForm, but it appears that the file upload has > > already begun at that point and while we can look at the Content-Length > > header from the HttpServletRequest object in the Struts Action, it's a > > moot step because the file has already begun to upload. > > Couldn't you keep the maxFileSize parameter then use the Content-Length > header to distinguish the two cases? Short of writing your own > implementation of MultipartRequestHandler, I don't think there's anyway > to hook into the file upload handling. > > L. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >