Background:
I am looking for a tool to upload big file asynchronously using ajax + Struts2, I was able to do the same thing using servlet but when I modify the logic to call struts action. I have noticed that when I try to upload a huge file using struts2 action, it doesn't get called from jquery ajaxForm(options);
I have used the sample code specified on the below link this works perfectly fine. http://www.simplecodestuffs.com/file-upload-with-progress-bar-using-jquery-in-servlet/
Can anyone tell if below jquery function call is correct for upload functionality. $("#uploadtest").ajaxForm(options);
I tried but it is not working as expected in one particular browser when huge data is uploaded. (That is, client ajax call occurs, however, the corresponding struts2 action is not getting called in the backend, logs are not generated on the server side). I am not able to understand why struts2 action is not getting called when jquery ajaxform
to upload huge file (multipart upload functionality).
jquery
$("#uploadtest").ajaxForm(options);
jsp snippet
<s:form id="uploadtest" name="uploadform" action="aStrutsAction" method="post" enctype="multipart/form-data">
Similar question is asked here ..FormData in IE8/9
The problem with uploading big files to the Struts2 action is that request may not comply the limits used by default with Struts2. In configuration settings the value is set to 2097152. You can also set the limits per action. More about it you can find in Struts2 File Upload - Advanced Configuration:
The next section from this docs page is File Size Limits where you have noticed about limitations of the file size used by the underline frameworks (struts2, commons-fileupload):
If the file size exceeds the above configuration settings, the pseudo progress bar stops as soon as it returns a response. It could be 1% or 100% it depends on thresh speed and a file size. But on the server side you might see an exception
and the following warnings. You might adjust the file size limitations with the framework if it doesn't exceed the framework's limitations itself.