tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Davison <peterdavi...@home.com>
Subject Re: Servlet File upload Oreily MultipartParser problems
Date Sat, 07 Jul 2001 16:15:48 GMT
I've got it to work on Linux but only using Tomcat stand-alone, not with
apache.

If I understand correctly, you are getting the input stream from the
request directly - "req.getInputStream()".

My understanding on how the MultipartParser works is that you instantiate 
a MultipartParser giving it the request, then iterate through the parts handling
the ParamParts one way and the FileParts another.  Something like:

MultipartParser mp = new MultipartParser(request, ...)
Part p = null;
while ((p = mp.readNextPart()) != null)
{
	if p is a paramPart ...
	else if p is a filePart
	{
		FilePart fp = (FilePart) p;
		InputStream is = fp.getInputStream();
		....
	}
}

So each FilePart has it's own inputStream.

Not sure what the "Y"s you are seeing mean, but the above works for me.

Regards,
Pete.
Thus spake "Randy Paries" <randy.paries@unitnet.com> on Sat, 7 Jul 2001 09:11:53 -0500:

RP> Hello,
RP> 
RP> does anyone have the Oreily MultipartParser file upload working with Tomcat
RP> and apache on Linux.
RP> 
RP> I have developed this upload servlet using Jbuilder 4 and Win2000. The
RP> servlet works with the Jbuilder debugger(tomcat 3.1) and jrun. But is does
RP> work when I push it to my production linux box.
RP> 
RP> When I execute the form to upload the image on the linux box, the form just
RP> hangs.
RP> 
RP> what is strange is that every time
RP> ServletInputStream in = req.getInputStream();
RP> is called I get a "Y" printed on the console.
RP> 
RP> Do anyone have this working on the linux config?
RP> 
RP> has anyone seen a similar problem?
RP> 
RP> Thanks
RP> 
RP> Randy
RP> 

Mime
View raw message