PSR
PSR

Reputation: 40318

Struts2 file upload max size

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.

Upvotes: 10

Views: 20553

Answers (3)

user497087
user497087

Reputation: 1591

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

Check how to configure here:

<Connector port="80" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443"
           maxPostSize="67589953" />

Upvotes: 2

Aleksandr M
Aleksandr M

Reputation: 24396

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://struts.apache.org/core-developers/file-upload.html#file-size-limits

Upvotes: 15

Anand Dwivedi
Anand Dwivedi

Reputation: 1500

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

Upvotes: 0

Related Questions