Exception information:
Critical: Servlet.service () for Servlets [Suibian] in context with path [/SPRINGMVCDEMO3] threw exception [Request processing Failed Nested exception is org.springframework.web.multipart.MaxUploadSizeExceededException:Maximum upload size of ten bytes exceeded; Nested exception is org.apache.commons.fileupload.fileuploadbase$sizelimitexceededexception: the request was Rejected because its size (9923) exceeds the configured maximum (Ten)] with root cause
org.apache.commons.fileupload.fileuploadbase$sizelimitexceededexception:the request was rejected because its Size (9923) exceeds the configured maximum (TEN)
At org.apache.commons.fileupload.fileuploadbase$fileitemiteratorimpl.<init> (FileUploadBase.java:797)
At org.apache.commons.fileupload.FileUploadBase.getItemIterator (fileuploadbase.java:323)
At org.apache.commons.fileupload.FileUploadBase.parseRequest (fileuploadbase.java:341)
At org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest (servletfileupload.java:126)
At Org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest ( commonsmultipartresolver.java:158)
Workaround:
1 <!--SPRINGMVC You need to configure the Multipartresolver processor when uploading files - 2 <BeanID= "Multipartresolver"class= "Org.springframework.web.multipart.commons.CommonsMultipartResolver"> 3 < Propertyname= "Defaultencoding"value= "UTF-8"/> 4 5 <!--Specifies that the total size of the uploaded file cannot exceed 200KB. Note the limitations of the Maxuploadsize attribute are not for individual files, but for the sum of the capacity of all files - 6 < Propertyname= "Maxuploadsize"value= "$"/>7 8 <!--resolvelazily property is enabled to defer file parsing in order to capture file size exceptions in Uploadcontroller - 9 < Propertyname= "Resolvelazily"value= "true"/> Ten </Bean>
Springmvc+commons-fileupload upload File size limit exception