Loading

上传文件报错:The field files exceeds its maximum permitted size of 1048576 bytes

问题研究:

Spring Boot configures Spring MVC with a maximum file of 1Mb per file and a maximum of 10Mb of file data in a single request

文件上传有默认最大限制,即最大可支持1MB的文件大小,在单个请求中最多可容纳10Mb的文件数据。且从这句disk by using the properties exposed in the MultipartProperties class...可以得知,这个文件上传大小限制可以自定义,可以在你的配置文件(.properties/.yaml)上自定义设置。(multipart.maxFileSize)

解决方法:

修改配置文件,增加:

# 最大上传单个文件大小:默认1M
spring.servlet.multipart.max-file-size=10MB
# 最大总上传的文件大小 :默认10M
spring.servlet.multipart.max-request-size=100MB

问题解决!!!

参考:

https://blog.csdn.net/weixin_44299027/article/details/126074192

https://blog.csdn.net/weixin_43970743/article/details/124000999

posted @ 2023-01-31 15:52  李旭2018  阅读(398)  评论(0编辑  收藏  举报