解决org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: 的问题

一。问题描述

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 #总文件大小限制(允许存储文件的文件夹大小)

再次上传文件,成功上传!

猜你喜欢

转载自blog.csdn.net/weixin_44009447/article/details/110469290