Problem : java.io.IOException: Corrupt form data: premature ending while file uploading

Problem : java.io.IOException: Corrupt form data: premature ending while file uploading

hi, i am trying to upload file in my jsp using oreally multipart request
I am getting the following error .
java.io.IOException: Corrupt form data: premature ending
Any idea why this error occurs?


Solution: java.io.IOException: Corrupt form data: premature ending while file uploading

Are you doing fileupload with Ajax? If so, for security reasons, Ajax does not support file upload.  The solution is create a web page and place the oreally multipart and get the page through the IFrame and do a submit using javascript.

Trigger the javascript on the IFrame page as in Block B:

Block A:
 function fnPostValues()
   {

        // Do any pre-checking of values if necessary

        document.formFileUpload.submit();

        // formFileUpload is the form ID

    }
Block B:

// "frameFileUpload" is the IFrame ID.

var frameFileUpload = (window.frames["frameFileUpload"] != null) ? window.frames["frameFileUpload"] : null;

frameFileUpload.fnPostValues();