码迷,mamicode.com
首页 > 编程语言 > 详细

springboot 大文件上传问题

时间:2020-03-13 01:09:33      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:cee   spring   文件上传问题   request   exce   config   类型   ipa   red   

1. nginx(413 Request Entity Too Large)

     首先:【http|server|location】  下设置:client_max_body_size 100m

     重启nginx:systemctl restart nginx 

    

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

     配置文件添加:

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

     启动类添加:

 @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 factory = new MultipartConfigFactory();
// 单个数据大小
factory.setMaxFileSize(maxFileSize);
// 总上传数据大小
factory.setMaxRequestSize(maxRequestSize);
return factory.createMultipartConfig();
}

 

springboot 大文件上传问题

标签:cee   spring   文件上传问题   request   exce   config   类型   ipa   red   

原文地址:https://www.cnblogs.com/changeEveryDay/p/12483806.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!