This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "upload utility" Watch "upload utility" New topic
Author

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
Bartender

Joined: Oct 29, 2001
Posts: 8935
    
    9

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: upload utility