0

Below is my source code and the error

MultipartParser parser;
parser = new MultipartParser(request, 1024 * 1024 * 1024);  //this line generates error
/* file limit size of 1GB*/
Part _part;
while ((_part = parser.readNextPart()) != null) {
    if (_part.isFile()) {
       FilePart fPart = (FilePart) _part; 
       inputStream = fPart.getInputStream();
    }
}

Below are my headers : enter image description here

Below is my error:

enter image description here

  • Please add the exception with the question. Hope this might help. https://stackoverflow.com/questions/240163/corrupt-form-data-premature-ending – Mebin Joe Apr 17 '19 at 07:17
  • Possible duplicate of [Corrupt form data: premature ending](https://stackoverflow.com/questions/240163/corrupt-form-data-premature-ending) – Muhammad Apr 17 '19 at 07:19
  • Exception e = java.io.IOException: Corrupt form data: premature ending java.io.IOException: Corrupt form data: premature ending – NAMRATA TODI Apr 17 '19 at 07:20
  • i have read that but not getting it – NAMRATA TODI Apr 17 '19 at 07:21
  • @NAMRATATODI My suggestion is to use latest version of `MultipartParser`. Also try to use `Apache Commons FileUpload` or just the new `Servlet 3.0` builtin `request.getPart()` method. See also How to upload files to server using JSP/Servlet https://stackoverflow.com/questions/2422468/how-to-upload-files-to-server-using-jsp-servlet/2424824#2424824 – Mebin Joe Apr 17 '19 at 07:27

1 Answers1

0

Check your headers like content length and encoding ,

You can use tools like fiddler to intercept see what is getting transferred.

Srinivasan Sekar
  • 2,049
  • 13
  • 22