aspose file tools*
The moose likes Servlets and the fly likes file upload problem..urgent please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "file upload problem..urgent please" Watch "file upload problem..urgent please" New topic
Author

file upload problem..urgent please

Sripathi Krishnamurthy
Ranch Hand

Joined: Mar 07, 2005
Posts: 232
I am trying to upload a 25 MB file from the browser(IE 6). The app server is Websphere (4.0.6) and HTTP Server is IBM Http Server (1.3.19).
I use com.oreilly.servlet.multipart.MultipartParser for uploading.

Example,

MultipartParser parser = null;
String redirect = null;
Bean sb = null;
try {
parser = new MultipartParser(req, 26214400);
// max size of image is 25MB
Part part;
FilePart filePart = null;
while ((part = parser.readNextPart()) != null)
{
String paramName = part.getName();
if (part.isFile()) {
filePart = (FilePart) part;
InputStream is = filePart.getInputStream();
ObjectInputStream o = new ObjectInputStream(is);
sb = (Bean) o.readObject();
o.close();
// add the bean object to the DB:

I setup a server from WSAD(Websphere Application development on WIN XP) and upload the file of 25mb, the upload is fine without any errors. It works perfectly.
BUT, but any image over 10 MB of size doesnt upload (in Websphere running on AIX 5) and throws an error.
I am trying on this issue since 4 days now without any benefit.

The error thrown is,
java.io.IOException: Corrupt form data: premature ending
at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:166)
at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:94)
at mypackage.servlets.dev.Saver.doPost(Saver.java:52)

and sometimes

java.io.IOException: unexpected end of part
at com.oreilly.servlet.multipart.PartInputStream.fill(PartInputStream.java(Compiled Code))
at com.oreilly.servlet.multipart.PartInputStream.read(PartInputStream.java(Compiled Code))
at java.io.ObjectInputStream.readFullyInternal(ObjectInputStream.java(Inlined Compiled Code))
at java.io.ObjectInputStream.bufferData(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.readInt(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.inputArray(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))

1) why does the upload happen fine when run in local WSAD environment and not in live environment?
2) Are there known issues in Websphere 4.0.6 and IBM HTTP Szerver 1.3.19?
3) What are the other options available for uploading larger file size other than using com.oreilly.servlet.multipart.MultipartParser?

please give me your very valuable feedback

Thanks in advance
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


1) why does the upload happen fine when run in local WSAD environment and not in live environment?
2) Are there known issues in Websphere 4.0.6 and IBM HTTP Szerver 1.3.19?
3) What are the other options available for uploading larger file size other than using com.oreilly.servlet.multipart.MultipartParser?

Just a guess, but since you say the upload is fine when everything is running locally, could it not be a network problem? You could try some sort of network monitoring tool to watch what is actually happening.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
And maybe sitting back and not being so rushed that you think your problem needs the urgent attention of the entire world might bring new perspectives as well (plus some time to read the naming policy of this site).


42
Sripathi Krishnamurthy
Ranch Hand

Joined: Mar 07, 2005
Posts: 232
Paul,
It cant be a network issue since I am able to upload 10mb file from the web. Anything greater than 10mb doesnt work. Also it immediately errs out when upload button is hit. So I think this is not a network issue.
I looked at the httpd.conf and nothing is set there to stop posting more than 10mb content.

Jeroen,
yes, I am still looking at lot of other possibilities. But not able to pinpoint the exact reason for this is what concerns me.

If anyone has any info on this, that will be greatly helpful.

Thanks
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


It cant be a network issue since I am able to upload 10mb file from the web. Anything greater than 10mb doesnt work. Also it immediately errs out when upload button is hit. So I think this is not a network issue.
I looked at the httpd.conf and nothing is set there to stop posting more than 10mb content

Hmm. That doesn't completely exclude network issues and I wouldn't rule it out so quickly. For the time it would take, it is always worth a look. Still, as I said its just a guess.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
To answer your third question, you can look at the Jakarta Commons FileUpload project.


James Carman, President<br />Carman Consulting, Inc.
Deepak sankhla
Greenhorn

Joined: Mar 14, 2005
Posts: 1
Hi Sripathi,
i m also using the same com.oreilly.servlet.multipart.MultipartParser for uploading image files, but in my case, i m not even able to upload files whose size>30k.
Did you get any luck with this problem? if yes then pls let me know...

thanks a bunch
Premil Jacob
Ranch Hand

Joined: Sep 10, 2004
Posts: 30
Just a suggestion, the GET method of sending values to the server has a size limit.


Thanks,<br />Premil<br /> <br />SCJP 1.4
Sripathi Krishnamurthy
Ranch Hand

Joined: Mar 07, 2005
Posts: 232
I still havent found any solution for this problem. In your case, I may help you out.
1) Check the httpd.conf and see if any setting has limited the content length. If yes, increase the limit.
2) check whether you are able to upload using different browser.that is if you are using IE, try with netscape or mozilla. If it works with another browser, contact Bill gates.
3) check whether the network is fine and supports heavy uploads. If not contact your system administrator.
4) check whether there is any problem in the form itself.
5) check whether the servlet is fine and works for smaller uploads. If uploads are fine for smaller uploads, the code cant be blamed.
6) Finally check the Webserver you are using and check the bug list and see if this is a known problem. I have checked this and most of the webservers have problem with larger uploads. some have fixed them though.

If all of the above dont work, then we are sailing in the same boat.
Bhiku Mhatre
Ranch Hand

Joined: Apr 08, 2002
Posts: 127
Check out if this helps.
http://www.coderanch.com/t/71730/Websphere/Upload-File-Doesn-work-Wepsphere

Regards,
Milind


The difference between winner and loser is making things happen and letting things happen.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: file upload problem..urgent please