How to specify file size limit for upload in struts 2?

I am trying to increase the default file upload size from 2 MB to 10 MB. and made some changes to my struts.xml file and added

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

and

 <interceptor-ref name="fileUpload"> <param name="maximumSize">500000</param> </interceptor-ref> 

for current configuration. but the value of the property object is null! and the download failed. some offer any solution to this problem.

+3
source share
1 answer

Have you checked the application server? For example, Tomcat has its own file upload limit (2 MB by default).

In the server.xml file in the Tomcat conf folder, you will need to add the maxPostSize attribute with the maximum file size (in bytes). For 10 MB, it would be something like this:

 <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" maxPostSize="10485760" /> 

I do not know about the configuration for other application servers, but should not be much different.

+1
source

Source: https://habr.com/ru/post/1437395/


All Articles