struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <Christoph.Nenn...@lex-com.net>
Subject Re: After migration to struts 2.3.24, file upload still not supported for greater than 2gb
Date Wed, 13 Jan 2016 09:53:03 GMT
> Hi&nbsp;&gt;&gt;&nbsp;Do you get an error message?
> No error message is obtained during the fileupoad.
> In our application all request are mapped to the filter. We traced 
> our request for the case of fileupload through the jsp mentioned 
> above.The 2 different scenario for different file sizes are:
> -&gt; When the file size is less than 2gbIn this case our fleupload 
> is successful. On checking the request in the filter, the 
> ServletRequest.getContentLength() methodreturns the correct file 
> length size in bytes.
> -&gt; When the file size is greater than 2gb (2^32-1 bytes)In this 
> case our fleupload is not successful.The fileupload action cannot 
> proceed as per the logs and nothing else is thrown.On checking the 
> request in the filter the ServletRequest.getContentLength() method 
> returns 0 instead of the correct file length size in bytes.The 
> further mapping for the request hence does not proceed.
> It is evident that there is problem with the servlet-api, that the 
> ServetRequest.getContentLength method returns a 32-bit int insteadof
> a 64-bit long.This is why it fails for file sizes in bytes larger than 
2gb.
> What needs to be done in order to correctly read Content-Length 
> headers with numbers bigger than 2^32 - 1, so that it supports 
> uploadsgreater than 2gb.
> 
> Thanks
> 
> &gt; Hi,&gt; File upload in my struts application is not successful 
> for greater&nbsp;&gt; than 2 gb. After previous discussion here on 
> previous thread, I&nbsp;&gt; migrated my application to struts 2.3.
> 24 as the only possible&nbsp;&gt; solution in form of jakarta-stream
> parser for large size uploads&nbsp;&gt; (greater than 2gb).&gt; But 
> after successfully migrating to struts 2.3.24 from 2.1.8, 
> file&nbsp;&gt; upload greater than 2 gb still not supported. I want 
> to use jakarta-&gt; streams for this purpose.Following is the code 
> snippet:&gt; In struts.xml:&amp;lt;constant 
> name="struts.multipart.parser"&nbsp;&gt; value="jakarta-stream" /
> &amp;gt;&amp;nbsp;&amp;lt;constant&nbsp;&gt; 
> name="struts.multipart.maxSize" value="3147483648" /&amp;gt;&gt; jsp 
> file:&amp;lt;s:form id="uploadData" 
> action="abc_UploadAction"&nbsp;&gt; namespace="xyz" 
> validateFields="false" method="post"&nbsp;&gt; enctype="multipart/
> form-data"&amp;gt;&gt;&nbsp;&gt; Alongwith with configuring 
> server.xml with maxPostSize e
>  lement and&nbsp;&gt; mutipart-config in web.xml But still the file 
> upload request for&nbsp;&gt; greater than 2 gb not 
> successful.&amp;nbsp;&gt; Thanks
> 
> Do you get an error message?Log entries?Stack traces?
> Please give us more detail about what is happening.
> 
> regards,Christoph
> This Email was scanned by Sophos Anti Virus
> 
> 
> 
> 


You might consider to upload files with AJAX instead of multipart form. 
That gives you the option to show a progress bar and thus better user 
experience. But of course it means you have to write and maintain more 
code.

Here are samples:

http://www.html5rocks.com/en/tutorials/file/dndfiles/

http://www.codeproject.com/Articles/685251/AJAX-file-uploader-with-progress-notification-in-p



Regards,
Christoph

This Email was scanned by Sophos Anti Virus

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message