Springboot设置文件上传大小,上传还是报错...

文章封面
摘要: springboot设置文件上传大小,默认是1mbspringboot默认文件大小的限制是1MB,超过1MB会出现这个错误:org.springframework.web.multipart.Mult

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 #当文件达到多少时进行磁盘写入

如果还是报错:

检查一下nginx的上传文件大小配置情况! ! !

3344 阅读 ← 返回技术栈
图片放大