wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts 2 FileUpload Interceptor Problem for Large File Size Upload.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 FileUpload Interceptor Problem for Large File Size Upload...." Watch "Struts 2 FileUpload Interceptor Problem for Large File Size Upload...." New topic
Author

Struts 2 FileUpload Interceptor Problem for Large File Size Upload....

Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138

Hi,

I am trying to upload large size file from my struts 2 web application.
for upload larger file i have mentioned file size in the param to the fileUplod interceptor.

It works fine for file size up to 2 MB... but when i try to upload file of size say 30 MB then the property object value is null!

The action declaration in struts.xml file is as follow:



I am confused and didn't get any clue about the problem ?

Can you please help me in this regard ?

Thanks

Rahul
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Some servers set an upload limit, and the upload library itself might set a limit.
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
Hello,

Thank you very much for replying!

According to my opinion.. i have not set any limit for file upload in server and etc.

But if this is case.. then How and where can i check/view that there is a limit set for File Upload ?

I am using Tomcat 6.0 and the Apache common-file upload and IO library...


Thanks

Rahul
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Tomcat docs for the Tomcat question, I think there's a commons-fileupload properties file; don't recall off the top of my head though.
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
Hi,

What is the default value for Tomcat Server Upload Limit and commons-file upload properties file upload limit ?

I did not got any properties file in commons-file upload jar file.
Also i have not put any separate properties file in my application for this purpose.

Sorry for some wrong thing i am asking, I am confused and did not get any clue about what you are saying here about file size.

Anyway, what is the other causes of above mentioned (previous post) Problem for larger file size except this reason ?

Also, in action declaration i have have provided the param with maximum Size for file Upload Interceptor, so i think it has to consider the provided param value for maximum file size. am i correct ?

Thanks

Rahul
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Yes, there's a max size for the upload interceptor, but there is still the Tomcat upload size, and I'm pretty sure there's one for commons-upload--but I might be misremembering that.
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138

Hi,

Thank you very much for reply and give me the clue about the problem.

I have searched doc and also XMLs for File Upload Limit for Tomcat... but i did not get such information for File Size Upload.

Is it sure that the Struts 2 File Upload Interceptor does not upload Large Size file due to the only the limit mentioned in the Tomcat Server File Upoad Limit or
Commons file size upload limit ?

I tried a lot but i did not fine any such information in Tomcat Server nor common file upload jar file...

Now.. What i have do upload the large file using Struts 2 Framework ? Can you please guide me ?

Thanks

Rahul
lokesh pattajoshi
Ranch Hand

Joined: Jul 29, 2009
Posts: 130
you can use these properties in your struts.xml within <struts>tag

<constant name="struts.multipart.maxSize" value="53477376" /> //give value as size in KB
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
Hi lokesh,

Thank you very much for your answer! your answer is worthy for me.

It works and now the application can upload any size of file up to the limit that we have provided!

Anyway, But the value that we provide to struts.multipart.maxSize is in BYTES not in KB.

Thanks

Rahul



lokesh pattajoshi
Ranch Hand

Joined: Jul 29, 2009
Posts: 130
Hi Rahul,
you are welcome yaar.
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
Hi,

The problem is solved now... But i have not understand one thing is that ....

How to configure the file upload interceptor using maximumSize parameter ?

Thanks

Rahul
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 FileUpload Interceptor Problem for Large File Size Upload....
 
Similar Threads
Struts2 File Upload Maximum Size
struts 2 upload problem
ModelDriver Interceptor + not getting my object
Struts 2 file upload tag type allowed error
Struts 2 Fileupload problem