Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring multipart file upload with gridfs size limit exception

Using Jhipster with Spring+Mongo and Gridfs to handle files saved in db. When I'm trying to upload files larger than 1Mb it gives me an 500 error:

java.io.IOException: UT000054: The maximum size 1048576 for an individual file in a multipart request was exceeded

Tried to set this in application-dev.yml without success:

spring:
    http:
        multipart:
            max-file-size: 10MB
            max-request-size: 10MB

How could this limit be changed?

like image 810
neptune Avatar asked Oct 18 '17 08:10

neptune


2 Answers

Try this,

spring:
    servlet:
        multipart:
            max-file-size: 10MB
            max-request-size: 10MB
like image 113
Pari Ngang Avatar answered Oct 24 '22 05:10

Pari Ngang


Add this content to WebConfigurer if exist

@Bean

public MultipartConfigElement multipartConfigElement() {

     MultipartConfigFactory factory = new MultipartConfigFactory();

     factory.setMaxFileSize("100MB");

     factory.setMaxRequestSize("100MB");

     return factory.createMultipartConfig();

}
like image 20
Musa Avatar answered Oct 24 '22 05:10

Musa