当前位置:网站首页>【Exception】The field file exceeds its maximum permitted size of 1048576 bytes.
【Exception】The field file exceeds its maximum permitted size of 1048576 bytes.
2022-07-31 03:03:00 【No8g Siege Lion】
TOC
I. Background description
This project is a Springboot project, the function is to do a file upload, and an error is found during the test. The uploaded file is a word file with a size of 1.25MB. The error message is as follows:
Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The fieldfile exceeds its maximum permitted size of 1048576 bytes.
The detailed error report is shown in the following figure:

Second, the reason for the error
SpringBoot project appears Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes. The error shows that the file size exceeds the allowed range.The reason is that the default size of all uploaded files in SpringBoot's embedded tomcat is 1MB. If this size is exceeded, an error will be reported. To solve this problem, you need to change the following two defaults.
- multipart.maxFileSize
- multipart.maxRequestSize
Three. Solution
The solution should be determined according to the version of SpringBoot. The following lists several situations, which can be corresponded according to the version of SpringBoot of your own project: just modify the default file size limit.The following is the file size limit used in my project, and changing it to 50MB can meet my needs.
Before 3.1 SpringBoot 1.3.x
multipart.maxFileSize=50Mbmultipart.maxRequestSize=50Mb3.2 SpringBoot 1.4.x
spring.http.multipart.maxFileSize=50Mbspring.http.multipart.maxRequestSize=50MbAfter 3.3 SpringBoot 2.0.x
spring.servlet.multipart.max-file-size=50MBspring.servlet.multipart.max-request-size=50MBAfter configuring the above restrictions, restart the project, Bingo, done!!!
It's over!
边栏推荐
- 【C语言】表达式求值的一般方法
- TCP详解(二)
- CorelDRAW2022精简亚太新增功能详细介绍
- 11. Redis implements follow, unfollow, and follow and follower lists
- CorelDRAW2022 streamlined Asia Pacific new features in detail
- SQL injection Less54 (limited number of SQL injection + union injection)
- 加密公司向盗窃的黑客提供报价:保留一点,把剩下的归还
- SQALE 是什么
- [Godot][GDScript] 二维洞穴地图随机生成
- LeetCode简单题之找到和最大的长度为 K 的子序列
猜你喜欢
随机推荐
如何搭建私有yum源
Discussion on Service Commitment of Class Objects under Multithreading
10 权限介绍
图解lower_bound&upper_bound
SonarQube的BUG定义
The simulation application of common mode inductance is here, full of dry goods for everyone
Word/Excel fixed table size, when filling in the content, the table does not change with the cell content
YOLOV5学习笔记(三)——网络模块详解
【编译原理】递归下降语法分析设计原理与实现
CentOS7下mysql5.7.37的卸载【完美方案】
Unity3D Button mouse hover enter and mouse hover exit button events
5. SAP ABAP OData 服务如何支持 $filter (过滤)操作
自动化办公案例:如何自动生成期数据?
解析小结—自用
QML的使用
什么是系统?
What is SQALE
Annotation usage meaning
How to build a private yum source
Discourse 自定义头部链接(Custom Header Links)









