File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes upload utility Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "upload utility" Watch "upload utility" New topic

upload utility

toukhir mujawar
Ranch Hand

Joined: Oct 11, 2006
Posts: 70
how can i upload my text file to the server from client... i have written the class for reading the file...
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Are you talking about JSP + servlets or JSF + backing beans?

Anyway, in general just put the file contents in a byte array and write it to the disk using FileOutputStream, optionally using BufferedOutputStream.
toukhir mujawar
Ranch Hand

Joined: Oct 11, 2006
Posts: 70
u did't understand my question... i can read the file and write it to disk... that is no proble... i want to upload the read file to the server.. by the way i m using beans...
Joe Ess

Joined: Oct 29, 2001
Posts: 9190

You really didn't give us much information to go off of, like what kind of server you have. If you are running a web container with servlets (notice that I'm still not sure), the common solution is to use MultipartRequest/MultipartParser or FileUpload on the server side and a multipart form or HttpClient on the client side.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: upload utility
jQuery in Action, 3rd edition