Java之文件上传大小受限的配置

我在进行文件上传时,报错

org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes.

解决方法是在application-dev.properties中配置

spring.servlet.multipart.max-file-size=500MB
spring.servlet.multipart.max-request-size=500MB

即可增加文件上传大小。

posted @ 2022-11-29 15:28  罗毅豪  阅读(143)  评论(0编辑  收藏  举报