I am trying to upload files larger than 1Mb with spring boot
hereorg.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes.
at org.apache.tomcat.util.http.fileupload.FileUploadBase$FileItemIteratorImpl$FileItemStreamImpl.<init>(FileUploadBase.java:618) ~[tomcat-embed-core-8.5.28.jar:8.5.28]
If you are using Spring 2.0 or higher add the below code which is working for me
application.properties
spring.servlet.multipart.max-file-size=128MB
spring.servlet.multipart.max-request-size=128MB
spring.servlet.multipart.enabled=true
application.yml
spring:
http:
multipart:
enabled: true
max-file-size: 128MB
max-request-size: 128MB
If you just want to control the multipart properties
then multipart.max-file-size
and multipart.max-request-size
properties should work.
File uploading problem solved by this configuration in application.yml:
spring:
data:
mongodb:
host: localhost
port: 27017
database: testone
servlet:
multipart:
enabled: true
maxFileSize: 500MB
maxRequestSize: 500MB
file-size-threshold: 500MB
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