1、springboot 2.1.0 上传文件太大报错
Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (216185201) exceeds the configured maximum (104857600)
2、处理方案:
1.查看Nginx 能否有限制请求数据大小
server {
listen 80;
#server_name localhost;
client_max_body_size 500M;
#charset koi8-r;
#access_log logs/host.access.log main;
location /test/ {
proxy_pass http://127.0.0.1:8080/test/;
}
}
其中: client_max_body_size 500M;必需打开,放开限制
3.查看tomcat能否有限制请求数据大小
在D:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\server.xml
connectionTimeout="20000"
maxPostSize="-1"
redirectPort="8443" />
maxPostSize 设置请求大小,-1代表不限制
4.springboot 设置请求大小限制
在application.properties配置:
spring.servlet.multipart.max-file-size=500MB
spring.servlet.multipart.max-request-size=500MB
以上就是springboot上传文件太大报错怎么解决的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号