I'm trying to make the example of this link: https://github.com/spring-guides/gs-uploading-files work with Apcahe commons-fileuploadbut the error: Required MultipartFile parameter 'file' is not present is occurring.

The configuration that I'm making on the example is:

1 - Adding the dependency of commons-fileupload in the pom.xml:

<dependency>
  <groupId>commons-fileupload</groupId>
  <artifactId>commons-fileupload</artifactId>
  <version>1.3.1</version>
</dependency>

2 - Config the multipartResolver() in the Application.java

@Bean
public MultipartResolver multipartResolver() {
  return new CommonsMultipartResolver();
}

Without this configuration everything works fine as Spring is using org.springframework.web.multipart.support.StandardServletMultipartResolver for handle uploads, but I want use commons-fileupload.

There is something that I'm missing?

Thanks.

@avaz

1

There are 1 best solutions below

0
On

You should disable MultipartAutoConfiguration like this below:

@EnableAutoConfiguration(exclude = MultipartAutoConfiguration.class)

Please see the DOC