How to handle maximum upload file size exceeded

0

I have an application, which uploads a file (spreadsheets), but after a recent test pointed this error:

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

I have already changed the application.properties to these values:

multipart.max-file-size=100MB
multipart.max-request-size=100MB

but the error persists. How can I handle this error?

    
asked by anonymous 10.12.2018 / 20:39

1 answer

1

I believe you are using Spring Boot for your application, following the documentation I see some other properties being used:

spring.servlet.multipart.max-file-size=200MB
spring.servlet.multipart.max-request-size=200MB
spring.servlet.multipart.enabled=true

Spring Boot Documentation - Tuning file upload limits

You may also need to change the server configuration, as pointed out by @SeaBiscuit in this StackOverflow post .

@Bean
public TomcatEmbeddedServletContainerFactory containerFactory() {
    TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
     factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
        @Override
        public void customize(Connector connector) {
         ((AbstractHttp11Protocol<?>) connector.getProtocolHandler()).setMaxSwallowSize(-1);
        }
     });
     return factory;
}

There should be some specific setting to apply also to WildFly.

    
13.12.2018 / 18:32