【已解决】KOCA文件模块, 调用 /file/upload 接口时报错

KOCA版本 :3.x-4.x
KOCA模块 :koca-file
模块版本 :3.x-4.x
场景 :用KOCA文件模块, 调用/file/upload 接口时报错
报错细节 :

java.lang.IllegalStateException: 
org.apache.tomcat.util.http.fileupload.impl.SizeLimitExceededException: 
the request was rejected 
because its size (116049639) exceeds the configured maximum (10485760)
  • 已经配置了最大上传大小但还是报上述错误
koca:
  file:
    manage:
      maxFileSize: 1073741824 #最大上传大小默认600M
      allowedFileTypes: #允许上传文件类型 默认为空
  • 报错原因:SpringBoot项目自带的tomcat对上传文件大小有默认的限制,SpringBoot官方文档中展示:每个文件的配置最大为1MB,单次请求的文件的总数不能大于10MB
  • 解决方法:在对应的配置文件中配置所需的文件大小值即可
spring:
  servlet:
    multipart:
    # maxFileSize 单个数据大小
      max-file-size: 20MB
   # maxRequestSize 总数据大小
      max-request-size: 20MB