SpringBoot 上传文件大小设置(报错)
2018-10-23 17:46
375 查看
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010957645/article/details/83310663
2018-10-23 17:40:34.150 WARN 1100 --- [nio-8080-exec-1] .m.m.a.ExceptionHandlerExceptionResolver : Resolved exception caused by handler execution: org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes.
原先是这样设置的,结果失效了
[code]# 最大支持文件大小 spring.http.multipart.max-file-size=100MB # 最大支持请求大小 spring.http.multipart.max-request-size=100MB
对照官方文档设置没问题啊
[code]# MULTIPART (MultipartProperties) spring.http.multipart.enabled=true # Enable support of multi-part uploads. spring.http.multipart.file-size-threshold=0 # Threshold after which files will be written to disk. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size. spring.http.multipart.location= # Intermediate location of uploaded files. spring.http.multipart.max-file-size=1MB # Max file size. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size. spring.http.multipart.max-request-size=10MB # Max request size. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size. spring.http.multipart.resolve-lazily=false # Whether to resolve the multipart request lazily at the time of file or parameter access.
后来发现我的项目中springboot由原来的1.5.3升级到2.0.5了。。看下了下2.0.5文档是酱紫的。。。
[code]# MULTIPART (MultipartProperties) spring.servlet.multipart.enabled=true # Whether to enable support of multipart uploads. spring.servlet.multipart.file-size-threshold=0 # Threshold after which files are written to disk. Values can use the suffixes "MB" or "KB" to indicate megabytes or kilobytes, respectively. spring.servlet.multipart.location= # Intermediate location of uploaded files. spring.servlet.multipart.max-file-size=1MB # Max file size. Values can use the suffixes "MB" or "KB" to indicate megabytes or kilobytes, respectively. spring.servlet.multipart.max-request-size=10MB # Max request size. Values can use the suffixes "MB" or "KB" to indicate megabytes or kilobytes, respectively. spring.servlet.multipart.resolve-lazily=false # Whether to resolve the multipart request lazily at the time of file or parameter access.
改成spring.servlet就好了
阅读更多相关文章推荐
- springBoot上传文件大小设置
- Spring boot设置文件上传大小限制
- springBoot上传文件大小设置
- springBoot上传文件大小设置
- springboot设置上传文件大小
- springboot 文件上传大小配置
- Spring boot 文件上传报错,大小超过默认限制大小
- SpringBoot文件上传大小限制
- spring boot 上传文件大小限制
- springboot--maven--idea --java base64上传文件大小受到限制
- SpringBoot限制文件或图片上传大小配置
- Springboot项目关于上传文件的大小限制
- springboot 配置springmvc文件上传大小
- springBoot multipart 上传文件大小设置
- spring boot上传文件大小限制
- Spring Boot——多文件上传大小超限问题解决
- struts2设置文件上传大小
- IIS文件上传、下载MIME类型设置和文件大小设置
- springboot+文件上传和下载