SpringBoot’s @MultipartConfig maxFileSize not taking effect

With Spring Boot 2.0, you should use this in your application.yml

spring:
  servlet:
    multipart:
      max-file-size: 100MB
      max-request-size: 100MB

From documentation:

Spring Boot embraces the Servlet 3 javax.servlet.http.Part API to support uploading files. By default, Spring Boot configures Spring MVC with a maximum size of 1MB per file and a maximum of 10MB of file data in a single request. You may override these values, the location to which intermediate data is stored (for example, to the /tmp directory), and the threshold past which data is flushed to disk by using the properties exposed in the MultipartProperties class. For example, if you want to specify that files be unlimited, set the spring.servlet.multipart.max-file-size property to -1.

Extracted from Appendix A of documentation

spring.servlet.multipart.max-file-size=1MB # Max file size. Values can use the suffixes “MB” or “KB” to indicate megabytes or kilobytes, respectively.

spring.servlet.multipart.max-request-size=10MB # Max request size. Values can use the suffixes “MB” or “KB” to indicate megabytes or kilobytes, respectively.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)