Reputation: 25790
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?
Upvotes: 8
Views: 7987
Reputation: 373
For Spring boot version 2.4.3 and after this version use this
spring.servlet.multipart.max-file-size=-1 spring.servlet.multipart.max-request-size=-1
Upvotes: 1
Reputation: 2573
spring.servlet.multipart.max-file-size=1000MB
spring.servlet.multipart.max-request-size=1000MB
spring.http.multipart.max-file-size=50MB
spring.http.multipart.max-request-size=50MB
Above both the way not working in my version(1.3.4) also,
So that i used following way and it's working,
multipart.enabled=true
multipart.max-file-size=100MB
multipart.max-request-size=100MB
Upvotes: 1
Reputation: 3357
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.
Upvotes: 1
Reputation: 691755
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
.
Upvotes: 15