Springmvc+commons-fileupload upload File size limit exception

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.