IIRC from previous threads, setting the maxFileSize cannot prevent
clients from submitting files larger than the limit you set, they can
only abort the processing thereof.  (This is not a Struts-specific
limitation.)  I believe the behavior you are seeing is the appropriate
behavior.  I think the appropriate action on the server side would be
to return an error to the user including an explanation that they
either (1)forgot to attach a file or (2) attempted to submit too large
a file.

It is unfortunate that we cannot prevent large file upload altogether,
but there's nothing in the HTML input element that relates to this,
and allowing any kind of file system access through JavaScript is a
security violation.  (From a security standpoint, it would seem
reasonable to allow access to files in an input field during an
onsubmit event, but no browsers do this.)

(Of course, I've never done much with file uploads at all, but I
believe this is the explanation that's been given in the past.)

-- Jeff

On 7/13/05, Marc Walter <[EMAIL PROTECTED]> wrote:
> Hi!
> 
> In want to use the controller element "maxFileSize" in the
> struts-config.xml in order to provide a global maximum file upload size in
> my application. So I entered the value "2M" (two megabytes) for test
> purpose.
> In my upload JSP I defined a submit button like this: <html:submit
> value="Submit" property="upload" styleClass="button" />
> When I choose a file greater than 2M and press the button the
> UploadAction.execute() method is performed. This is okay so far. In this
> method I search the request object for the value "upload" but it can't be
> found! If I remove the struts-config.xml controller entry "maxFileSize" the
> request parameter "upload" is found and the adequate code is processed. So
> it is as well if the file is less than 2M in size.
> 
> So now I wonder why the usage of the "maxFileSize" attribute in conjunction
> with a file exceeding the given max size apparently removes my "upload"
> parameter from the request. The UploadAction is still being processed! Does
> someone have an explanation for this? I don't understand this struts
> behaviour. Thanks!
> 
> Kind regards,
> Marc Walter
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to