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