How to Handle Exceeded Maximum File Upload Size

Asked

Viewed 673 times

0

I have an application, which uploads a file (spreadsheets), but after a recent test pointed out 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 treat this mistake ?

  • Hello! Could pass complete error?

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 post from Stackoverflow.

@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 must be a specific setting to apply to Wildfly as well.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.