其他分享
首页 > 其他分享> > springboot设置文件上传大小,默认是1mb

springboot设置文件上传大小,默认是1mb

作者:互联网

springboot默认文件大小的限制是1MB,超过1MB会出现这个错误:org.springframework.web.multipart.MultipartException。

通过设置application.yml文件属性更改文件大小限制如图:

spring:
  servlet:
    multipart:
      enabled: true #是否启用http上传处理
      max-request-size: 100MB #最大请求文件的大小
      max-file-size: 20MB #设置单个文件最大长度
      file-size-threshold: 20MB #当文件达到多少时进行磁盘写入

 

标签:文件大小,springboot,文件,multipart,file,1mb,上传,size
来源: https://blog.csdn.net/qq_33243189/article/details/89631495