You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
712 B
27 lines
712 B
3 years ago
|
package com.web.config;
|
||
4 years ago
|
|
||
|
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
||
|
import org.springframework.context.annotation.Bean;
|
||
|
import org.springframework.context.annotation.Configuration;
|
||
|
|
||
|
import javax.servlet.MultipartConfigElement;
|
||
|
|
||
|
@Configuration
|
||
|
public class MultipartConfig {
|
||
|
|
||
|
/**
|
||
|
* 文件上传配置
|
||
|
* @return
|
||
|
*/
|
||
|
@Bean
|
||
|
public MultipartConfigElement multipartConfigElement() {
|
||
|
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||
|
//文件最大
|
||
|
factory.setMaxFileSize("300MB"); //KB,MB
|
||
|
//设置总上传数据总大小
|
||
|
factory.setMaxRequestSize("350MB");
|
||
|
return factory.createMultipartConfig();
|
||
|
}
|
||
|
|
||
|
}
|