【踩坑】SpringBoot文件上传超出范围
前言
SpringBoot文件上传超出范围,报错:The field fileImage exceeds its maximum permitted size of 1048576 bytes.
原因
- SpringBoot默认文件上传范围为
spring.http.multipart.maxFileSize
:单个文件的大小spring.http.multipart.max-request-size
:单次请求的文件的总大小
1 | spring: |
解决问题
- 如果不想限制上传文件大小,把
单个文件的大小
和单次请求的文件的总大小
都设置为-1
即可
1 | spring: |