Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 1 : Problem in uploading a file exceeding the configured max size limit

 
Khp Virajith
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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-scopedattribute 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?
 
Khp Virajith
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hasn't anyone encountered this before?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic