一。问题描述
SpringBoot项目上传较大文件时出现以下报错:
org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (159612974) exceeds the configured maximum (10485760)
二。解决办法
在application.yml文件中添加以下配置:
spring:
#邮件附件上传文件大小限制
servlet:
multipart:
max-file-size: 10240MB #单个文件大小限制
max-request-size: 10240MB #总文件大小限制(允许存储文件的文件夹大小)
再次上传文件,成功上传!