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
<connector port="8080" protocol="http/1.1"
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上传文件太大报错怎么解决的详细内容。