Struts2 File upload breakthrough 2M limit

Source: Internet
Author: User

strutsuploadfileactionclassstruts configuration file [HTML] view Plaincopyprint? 1. <action name= "FileUpload"class= "Cn.timefly.strutsTest.FileUploadAction" >      2. <result name= "Success" >/FileUploadResult.jsp</result>      3. <result name= "Input" >/FileUpload.jsp</result>      4. <interceptor-ref name= "FileUpload" >      5. <param name= "MaximumSize" >5000000</param>      6. <param name= "Allowedtypes" >application/vnd.ms-powerpoint</param>      7. </interceptor-ref>      8. <interceptor-ref name= "Defaultstack"/>      9. </action>struts2 File Upload default size is 2M, if you need to force the size of the change to more than 2M will be an error if you need to upload 5M files, in the Struts.xml configuration file you need to add such a sentence: [HTML] View Plaincopyprint? 1. <constant name= "struts.multipart.maxSize" value= "9000000"/>Struts.multipart.maxSize and FileUpload interceptors are found to have different division of MaximumSize attributes, summarized as follows:1struts.multipart.maxSize controls the maximum size of the uploaded files for the entire project (all files uploaded to this project at a time). More than this size, background error, the program can not handle such a large file. Fielderror will have the following hint: The request was rejected because its size (16272982) exceeds the configured maximum (9000000)2the MaximumSize attribute (maximum value of a single file) for the. 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. 3When uploading a file larger than Struts.multipart.maxSize, the system error when uploading files between Struts.multipart.maxSize and MaximumSize, the system prompts: file too large: File"MSF concept. ppt" "Upload__5133e516_129ce85285f__7ffa_00000005.tmp" 6007104when the uploaded file is less than MaximumSize, the upload is successful. From//blog.csdn.net/android_robot/article/details/6822604>

Struts2 File upload breakthrough 2M limit

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.