Maximum upload size exceeded;nested exception is java.lang.IllegalStateException

The error is reported as follows: Recently, the following problems were encountered when uploading test files.

        Resolved [org.springframework.web.multipart.MaxUploadSizeExceededException: 
Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException:
The field file exceeds its maximum permitted size of 1048576 bytes.]

reason:

        Springboot file upload error occurs because the file size exceeds the limit. You need to configure the size of the files allowed to be uploaded.
Because springboot's default single file upload size is 1MB, the default multiple file upload total size is 10MB.

solve

 Set the size of the uploaded file in the application.yml  file

spring: 
  servlet: 
    multipart: 
      max-file-size: 10MB #Maximum limit for a single file 
      max-request-size: 50MB #Maximum limit for multiple files

Gateway solution:

Note: The path here must be selected: otherwise an error will be reported. I have checked the code for two days! !

Guess you like

Origin blog.csdn.net/Relievedz/article/details/129156063