Thursday, May 10, 2018

How to set the max size of upload file in Spring Boot embedded Apache Tomcat

Error in spring boot : org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field uploadfile exceeds its maximum permitted size of 1048576 bytes. I found the solution at Expert Exchange, which worked well.
@Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        factory.setMaxFileSize("124MB");
        factory.setMaxRequestSize("124MB");
        return factory.createMultipartConfig();
    }
Expert Exchange

No comments: