springboot large file upload problem

1. nginx(413 Request Entity Too Large)

     First of all: [http | server | location] under Settings: client_max_body_size 100m

     重启nginx:systemctl restart nginx 

    

2. springboot设置   (报错类型:the request was rejected because its size (226000000) exceeds the configured maximum (104857600))

     Profile adds:

 spring:
servlet:
multipart:
max-request-size: 300MB
max-file-size: 300MB

     Start classes are added:

 @Value("${spring.servlet.multipart.max-request-size}")
private String maxFileSize;
@Value("${spring.servlet.multipart.max-file-size}")
private String maxRequestSize;
@Bean 
public MultipartConfigElement multipartConfigElement () {
MultipartConfigFactory new new MultipartConfigFactory Factory = ();
// single data size
factory.setMaxFileSize (the maxFileSize);
// uploads data size
factory.setMaxRequestSize (maxRequestSize);
return factory.createMultipartConfig ();
}

 

Guess you like

Origin www.cnblogs.com/changeEveryDay/p/12483806.html