My application server is Tomcat and I need is to upload files (large size) to my application. The body size of POST
requests is really long like 15 MB or more.
Is there any type of configuration or code I can set to overcome this problem?
Please keep in mind that this is multipart
request with file upload
Many thanks in advance
Tomcat 7 and and above has a configuration called maxSwallowSize
that specify number of bytes for an upload with a default value of 2MB. If your application is configured to accept bigger file, for example with a MultipartResolver in Spring, Tomcat will reject the request.
Because you can configure file size in your application, my advice is to disable maxShallowSize
in {TOMCAT_HOME}/conf/server.xml
using value -1
and then work only with size configured in your application
as follows:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxSwallowSize="-1"/>
You can find a detailed description here (with spring framerwork)