Struts file upload blocker maximumsize setting file size does not work

Source: Internet
Author: User

<interceptor-ref name= "FileUpload" >
<param name= "Allowedtypes" >image/bmp,image/png,image/gif,image/jpeg,image/pjpeg</param>
<!--picture cannot be greater than 5M
<param name= "MaximumSize" >5242880</param>
</interceptor-ref>

Problem:

Set the picture can not be greater than 5M, but upload more than 2M image directly error jump input;

Workaround:

<!--the largest size of files uploaded throughout the project
<constant name= "struts.multipart.maxSize" value= "9000000"/>;

1.struts.multipart.maxsize controls the maximum size of files uploaded throughout the project. More than this size, background error, the program can not handle such a large file. Fielderror inside will have the following hints:
The request was rejected because its size (16272982) exceeds the configured maximum (9000000)


The MaximumSize property of the 2.fileUpload interceptor must be less than the value of struts.multipart.maxSize.
Struts.multipart.maxSize default 2M, when MaximumSize is greater than 2M, you must set the value of struts.multipart.maxSize greater than maximumsize.


3. When the uploaded file is larger than Struts.multipart.maxSize, the system error
When uploading files between Struts.multipart.maxSize and MaximumSize, the system prompts the upload to be successful!

Struts file upload blocker maximumsize setting file size does not work

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.