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
1. First configure max file upload in Spring ( override default value 1MB)
form spring mvc create
bean
:for spring boot : add in
application.properties
2. Second thing configure your tomcat :
locate your server xml tomcat file
$TOMCAT_HOME/conf/server.xml
then chnage your connector as below by example :
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 applicationas follows:
You can find a detailed description here (with spring framerwork)