springboot+springcloud上传文件大小超出1M报错

报错如下
org.springframework.web.multipart.MultipartException","message":"Could not parse multipart servlet request; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field picture exceeds its maximum permitted size of 1048576 bytes."

解决方法:

springboot自带tomcat附件上传大小限制为1M,可在application.properties中进行配置

#配置文件上传的限制
spring.http.multipart.enabled=true
spring.http.multipart.max-file-size=20MB
spring.http.multipart.max-request-size=1000MB
如果使用了网关,需要在网关的配置文件中也配置上以上内容。


你可能感兴趣的:(springboot+springcloud上传文件大小超出1M报错)