To my Spring Boot 2.0.0.M6 application.properties
I have added the following lines:
spring.http.multipart.max-file-size=100MB
spring.http.multipart.max-request-size=100MB
but when I try to upload to my RestController the 21MB file it fails with the following exception:
Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (21112803) exceeds the configured maximum (10485760)
I run my application on Embedded Tomcat packaged with Spring Boot.
How to properly configure my application in order to allow file upload up to 100MB?
As shown in the documentation, and in its appendix, the correct properties are spring.servlet.multipart.max-file-size
and spring.servlet.multipart.max-request-size
.
For SpringBoot 1.5.7 till or before 2.1.2 the property need to set in application.properties file are:
spring.http.multipart.max-file-size=100MB
spring.http.multipart.max-request-size=100MB
Also make sure you have application.properties file in "resources" folder. In case you are not sure with the size then "-1" is the value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With