Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Struts2 file upload max size

Tags:

struts2

I need to upload files upto 10 MB.I used the following .In my struts.xml i configured like as follows.

<action name="doUpload" class="com.example.UploadAction">
<interceptor-ref name="fileUpload">
    <param name="maximumSize">20971520</param>
</interceptor-ref>
</action>

I did not configured any where other than this.I am getting the following error.

the request was rejected because its size (2102840) exceeds the configured maximum (2097152)

Can any one suggest me what might be the reason.Thanks in advance.

like image 841
PSR Avatar asked Oct 29 '12 11:10

PSR


3 Answers

Put this in your struts.xml file

<constant name="struts.multipart.maxSize" value="30000000" />

See http://struts.apache.org/2.x/docs/file-upload.html#FileUpload-AdvancedConfiguration.

Updated link - https://cwiki.apache.org/confluence/display/WW/File+Upload

like image 136
Aleksandr M Avatar answered Nov 06 '22 06:11

Aleksandr M


Also check your container configuration. Tomcat itself, for example, has a maxPostSize parameter which, if not set defaults to 2097152 (2Mb)

like image 23
user497087 Avatar answered Nov 06 '22 07:11

user497087


put this code on your strtus.xml:

<constant name="struts.multipart.maxSize" value="50000000" />

where value denotes your file size limit . if you want to extend the limit you can change the value as well . hope it helps

like image 1
Anand Dwivedi Avatar answered Nov 06 '22 07:11

Anand Dwivedi