Home > Java > javaTutorial > body text

How to solve the error when uploading file in springboot is too large

王林
Release: 2023-05-18 14:40:06
forward
3820 people have browsed it

1. Springboot 2.1.0 reports an error when the upload file is too large

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. Solution:

1 .Check whether Nginx can limit the request data size

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/;

}

}

Among them: client_max_body_size 500M; must be opened, release restrictions

3. Check whether tomcat can limit the request data size

In D:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\server.xml

##             connectionTimeout="20000"

                                                                                                                                                        connectionTimeout="20000"

                                  maxPostSize=" -1"

##                             redirectPort="8443" />

maxPostSize sets the request size, -1 means no limit

4.springboot Set request size limit

Configure in application.properties:

spring.servlet.multipart.max-file-size=500MB

spring.servlet.multipart.max-request-size=500MB######

The above is the detailed content of How to solve the error when uploading file in springboot is too large. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template