1.图片上传须在nginx中设置:

springboot 图片上传

nginx 默认的上传文件最大只支持1Mb,如果传输大于此数值会报 413  Request entity too large 的错误。

2. springboot 的 application.properties 中需设置参数

multipart.maxFileSize=50Mb
multipart.maxRequestSize=50Mb

springboot的默认也是1Mb 否则会报:

Could not parse multipart servlet request; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (24051324) exceeds the configured maximum (10485760) 的问题。

 

相关文章: