You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by João Folha <jo...@lis2.siemens.pt> on 2001/06/19 17:12:38 UTC

How to upload a binary file?

Hi there,

I am trying to upload a file from the client to the server.
But the binary files fail and the text files don´t fail.
I use tomcat 3.2.1 with apj12, on NT4.0
The bean and the jsp file i use are in attachment...

regards

jfolha


RE: How to upload a binary file?

Posted by Christian Amann <c....@ac-multimedia.de>.
Hi,

I am sorry that I don't have time to read your sourcecode completely, but
there is a very simple solution to upload files to a servlet or a jsp. There
is a special package from oreilly.com for uploading files of different
content-types from a browser.
In my JSP I have just one line that can do this:

import com.oreilly.servlet.*;

...in the doGet or doPost method:

MultipartRequest multi = new MultipartRequest(request, filename);

"filename" is the path where you want to save the uploaded file. There are
much more cool things you can do with the oreilly-package. Just visit
http://www.servlets.com/jservlet/examples/ch04/index.html#ex04_17 for an
example.

Good Luck :)

Christian Amann

problem installing catalina

Posted by ne...@yahoo.com.
hi
>   i have downloaded and configured catalina for
winnt
>   the examples files sre running perfect
>   my jsp are not getting recognized
>   i created a directory in webapps and put my jsps
in
> it
>   i get page not found error
>
>   The environment variables,java_home and
> catalina_home are set
>   and when i run the catalina.bat it just flashes
>   there is an unrecognized command in that file
>   so please give me a solution immediately
>
> Regards
> Thiaga


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Re: How to upload a binary file?

Posted by Hemant Singh <he...@yahoo.com>.
HI Folha:
The reason is because yur are using readLine function
in your program which can shuffle or make u loose some
bytes from the file, This is most likely to occur in
binary file, So you need to modify yur program so that
yu use read function instead of readLine and it will
definetely going to work

Regards
Hemant
--- Jo�o_Folha <jo...@lis2.siemens.pt> wrote:
> Hi there,
> 
> I am trying to upload a file from the client to the
> server.
> But the binary files fail and the text files don�t
> fail.
> I use tomcat 3.2.1 with apj12, on NT4.0
> The bean and the jsp file i use are in attachment...
> 
> regards
> 
> jfolha
> 
> 

> ATTACHMENT part 2 application/octet-stream
name=upload.java


> ATTACHMENT part 3 application/octet-stream
name=doc_entrega_autor.jsp



__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/