Java Web Max Upload File Size Settings
Max Upload File Size in Nginx
The default max upload file size in Nginx
The default maximum body size of a client request, or maximum file size, that Nginx allows you to have, is 1M. So when you try to upload something larger than 1M, you get the following error: 413: Request Entity Too Large.
When over the max upload file size
When uploading a file over max size, Nginx returns
status code: 413 Request Entity Too Large
Content-Type: text/html
response body:
<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.18.0</center>
</body>
</html>
Solutions
Add the following settings to your Nginx configuration file nginx.conf
http { |
Reload the Nginx configurations
$ nginx -s reload |
Max Upload File Size in Spring Framework
The default max upload file size in Spring
MultipartProperties‘ Properties
- max-file-size specifies the maximum size permitted for uploaded files. The default is 1MB
- max-request-size specifies the maximum size allowed for multipart/form-data requests. The default is 10MB.
When over the max upload file size
The Java web project will throw the IllegalStateException
- UT005023: Exception handling request to /file/uploadFile |
Solutions
Add the following settings in your spring boot configuration file application.yml
spring: |