SpringBoot文件上传大小设置方式(yml中配置)
作者:清晨的第一抹阳光 时间:2021-09-21 09:26:47
文件上传大小设置
#文件大小 MB必须大写
# maxFileSize 是单个文件大小
# maxRequestSize是设置总上传的数据大小
spring:
servlet:
multipart:
enabled: true
max-file-size: 20MB
max-request-size: 20MB
提示:
必须配置,如果采用默认的配置,稍大的文件就不能上传了。
上传文件大小yml参数配置
springboot改版本后遇到的问题:旧版本上传文件大小配置在新版本不生效
解决方法
旧版本中http改为servlet
1.5.x
spring:
http:
multipart:
max-file-size: 10MB # 单个文件的大小
max-request-size: 100MB # 上传文件的总大小
2.2.x
spring:
servlet:
multipart:
max-file-size: 10MB # 单个文件的大小
max-request-size: 100MB # 上传文件的总大小
来源:https://www.cnblogs.com/116970u/p/10579245.html
标签:文件上传,大小,yml,配置
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Eclipse的Debug调试技巧大全(总结)
2023-11-25 06:14:06
![](https://img.aspxhome.com/file/2023/3/59993_0s.png)
Java将json对象转换为map键值对案例详解
2023-11-28 07:38:43
![](https://img.aspxhome.com/file/2023/9/60129_0s.png)
详解Java设计模式编程中的访问者模式
2023-11-28 01:00:43
![](https://img.aspxhome.com/file/2023/0/58920_0s.jpg)
一次排查@CacheEvict注解失效的经历及解决
2023-11-13 12:07:23
![](https://img.aspxhome.com/file/2023/0/59200_0s.png)
Java擦除和转换实例分析
2022-03-30 02:19:45
IDEA(jetbrain通用)使用教程图解
2023-04-15 04:05:49
![](https://img.aspxhome.com/file/2023/9/61389_0s.gif)
OpenCV实现直线拟合
2023-06-22 15:22:37
![](https://img.aspxhome.com/file/2023/4/92494_0s.jpg)
Flutter模仿实现微信底部导航栏流程详解
2023-06-21 11:46:12
![](https://img.aspxhome.com/file/2023/3/100603_0s.png)
java.lang.NoClassDefFoundError错误解决办法
2021-12-29 03:52:27
java 中sendredirect()和forward()方法的区别
2021-11-07 18:39:28
Spring Security实现自动登陆功能示例
2023-01-29 15:31:55
![](https://img.aspxhome.com/file/2023/6/61156_0s.png)
java导出csv格式文件的方法
2022-07-24 20:26:36
![](https://img.aspxhome.com/file/2023/5/62665_0s.jpg)
java 如何远程控制tomcat启动关机
2023-04-10 03:21:47
![](https://img.aspxhome.com/file/2023/0/60760_0s.png)
Android Flutter实现搜索的三种方式详解
2023-07-10 18:00:49
JAVA 格式化日期、时间的方法
2023-10-17 07:53:22
hadoop运行java程序(jar包)并运行时动态指定参数
2023-07-27 11:02:10
![](https://img.aspxhome.com/file/2023/9/57829_0s.png)
腾讯云部署javaWeb项目的实现步骤
2023-11-05 18:03:29
![](https://img.aspxhome.com/file/2023/1/58911_0s.png)
Java基于rest assured实现接口测试过程解析
2022-07-25 09:30:25
java字节码框架ASM的深入学习
2023-11-29 05:51:19
Java Vector和ArrayList的异同分析及实例讲解
2023-12-03 17:27:10