Limit Struts2 file upload max size without uploading the whole file

前端 未结 1 665
逝去的感伤
逝去的感伤 2021-01-13 17:21

I am trying to implement a file upload in JSP/Struts2, and I noted a strange behaviour. I declared my action that way in struts.xml to limit file size to 1MB



        
1条回答
  •  遥遥无期
    2021-01-13 17:50

    There are two file size parameters one has to do with individual files sizes the other with the the maximum multi part file size. This is in place because you can receive an array of files if you wish (just change the setters type from File to File[], so easy), say struts.multipart.maxSize is set to 10MB and file size (maximumSize) is set to 1 MB you should be able to receive 10 1MB files. So the buffer should be allowed to grow to 10 MB.

    
    
    
        
    
        
        
        
            500000
         
        
        
    
        good_result.jsp
        
    
    

    Source: https://cwiki.apache.org/confluence/display/WW/File+Upload#FileUpload-FileSizeLimits

    0 讨论(0)
提交回复
热议问题