Orielly Maultipart Request : unexpected end of part
Zulaikha Moidin
Greenhorn
Joined: Mar 18, 2008
Posts: 2
posted
0
Hi,
I am trying to upload files to my server using oriellys MultipartRequest.
I seem to get the following exception at random times
[2008-03-17 12:59:13,656] java.io.IOException: unexpected end of part at com.oreilly.servlet.multipart.PartInputStream.fill(PartInputStream.java:100) at com.oreilly.servlet.multipart.PartInputStream.read(PartInputStream.java:183) at com.oreilly.servlet.multipart.PartInputStream.read(PartInputStream.java:156) at com.oreilly.servlet.multipart.FilePart.write(FilePart.java:208) at com.oreilly.servlet.multipart.FilePart.writeTo(FilePart.java:167) at com.oreilly.servlet.MultipartRequest.(MultipartRequest.java:266)
The code that causes this error is MultipartRequest mReq; try { mReq = new MultipartRequest(request, FileUtil.getSharedTmpDir().toString(), MAX_FILE_BYTE_SIZE, Encoding.STRING_ENCODING, RENAMER); }
The real problem is that, the upload works sometimes and sometimes throws this error. It seem to throw error more often when I upload large files(>100K) but not always.
I am using Tomcat6.0/ apache
not much information in the oreilly faq site. I googled about this issue and found that it could be a AJP13 bug. I am not able to find how to fix this. Any suggestion or help is greatly appreciated.
Zulaikha Moidin
Greenhorn
Joined: Mar 18, 2008
Posts: 2
posted
0
some more info on the above issue. I seem to get this more often in Firefox.
I submit the form via Javascript and not through form
document.body.appendChild(theDiv); var hiddenForm = document.getElementById("hidden_form"); fileParent.removeChild(theFile);
// attach the file to the hidden form and submit hiddenForm.appendChild(theFile); hiddenForm.submit(); // call server for updates on the status of file upload