-->

Struts 1.x file upload when file size > 8MB

2019-08-18 21:00发布

问题:

I want to upload a file(zipped excel) in my application. The file size is almost 8MB. So it gives size error.

I have tried to upload a small file, it works fine. But for size> 1 MB, it does not work.

Is there any work around for uploading big (zipped) files???

I am using Struts 1.x framework.

Thanks in advance!

回答1:

From http://tomcat.apache.org/tomcat-5.5-doc/config/http.html

maxPostSize

The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).

Locate server.xml in {Tomcat installation folder}\ conf \

8*1024*1204 =8388608

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

Put the limit in maxPostSize..