Search code examples
javaspringspring-boottomcatfile-upload

Max limit of MultipartFile in Spring Boot


Is there a maximum file size that spring boot can handle in a MultipartFile upload process. I know that I can set the maxFileSize in the property like multipart.maxFileSize=1Mb.

So, like that can I allow a huge file to upload, like 50MB. The application runs on the Tomcat server integrated with Spring Boot. Do I need to configure the tomcat server also? Or is the file size unlimited?


Solution

  • For unlimited upload file size

    It seems setting -1 will make it for infinite file size.

    Before Spring Boot 2.0:

    spring.http.multipart.max-file-size=-1
    spring.http.multipart.max-request-size=-1
    

    After Spring Boot 2.0:

    spring.servlet.multipart.max-file-size=-1
    spring.servlet.multipart.max-request-size=-1