tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Euclides da Silva Junior - DIGR.O" <jose.eucli...@rj.previdenciasocial.gov.br>
Subject RES: Multipart form handling help
Date Wed, 22 Nov 2000 17:29:03 GMT
-----BEGIN PGP SIGNED MESSAGE-----

Dear Shanx,
I ve gotten the same problem as you,too!  What should we do?
Best Regards,

José Euclides Júnior
__________________________________
E-mail: jose.euclides@rj.previdenciasocial.gov.br
            javabrasil@usa.net 
            bl1link@usa.net
http://euclides.8m.com
If i fail, if i succeed, at least i live as i believe.

- -----Mensagem original-----
De:		Shanx [SMTP:admin@shanx.com]
Enviada em:		Quarta-feira, 22 de Novembro de 2000 14:43
Para:		tomcat-user@jakarta.apache.org
Assunto:		Multipart form handling help

Can someone give me a sample of how to handle image uploads?

Here is a detailed description of the problem I am facing. I have a FORM
with a "input type=file" tag, and when someone submits this form, I read all
the bytes from the inputStream, convert it into CHAR and display it.
However, this works ONLY if there is ONLY an image upload field in the form.
If I add a "input type=text" tag in the form, then this doesnt work and the
bytes of the image are displayed as junk text.

I guess this is because of the "content type"..in case of the form which has
only the FILE input element, the content type doesnt matter. However, if the
TEXT imput element is added, the content type changes to TEXT/HTML and hence
the bytes from the uploaded image are displayed as junk.

I also tried doing an "IMG SRC" of the image bytes in the submitted page.
But this doesnt work as well!

I have been investigating the MultiPartRequest.java class, but I cant seem
to figure out how to preview the uploaded image in a browser -- (write these
bytes to the browser). There is a patchy solution that I am thinking of
right now, which basically saves the images to the server in a temp drive
and then displays it. But comeon, Java should be more powerful than that!

I'd appreciate any ideas/code samples. Thanks!

</Shanx>

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.1

iQCVAwUBOhwcWd0YhuJ3BUxtAQGeTQP8DQwt41xTYhDDX4M3SpPl24PfJ53DOuPt
COGEK7brfpgcsijEQgsrYo9AqjT4HzipEt7LiOB9R7qFm88LGoyci0CWJMxzVCux
SUu3v+mGIaAjgSIFSHaMt4wiub0NGHb2r/xiDONmKW70HKHdcPH3z+7+OQ0xNUHi
A28YmcYrVI4=
=8LpT
-----END PGP SIGNATURE-----

Mime
View raw message