You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Virajith KHP <kh...@gmail.com> on 2010/01/26 18:31:42 UTC

Struts 1 - Problem regarding uploading large files

Hi friends,

I have encountered an unusual behaviour with respect to file upload
capability in Struts 1 application.

I have configured the max upload file size limit using the <controller> tag
in struts configuration file as follows.

<controller maxFileSize="500K" />

Struts uses common fileupload library to handle file uploading functionality
by default and if the file being uploaded exceeds the max file size, it sets
a request-scoped attribute in the type of Boolean, under the name of the
constant value : MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED.

But I experienced an unusual behaviour with large file upload. When
uploading a larger file which is 300MB in size, my page hangs as the browser
keeps sending the request data (obviously the file data stream) . But from
server side, as soon as it determines that the file size is greater than the
size limit, it immediately sets the earlier mentioned request-scoped
variable and jumps out of the Action layer. So I feel that the request
processing is not hung at server side, but browser keeps sending file data
to the server even though the server has finished processing the request. Is
there any solution for that? Am I missing something?

I'm using Struts 1.2.7 and commons file upload 1.0 combination. Also I
re-tested the same functionality in latest Struts version that is 1.3.10
with common file uploads 1.2, but the behaviour is same.

Does anyone have any idea on solving this?