This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes download file from server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "download file from server" Watch "download file from server" New topic

download file from server

R. Roy

Joined: Apr 16, 2006
Posts: 7
I want to download the content of a specified directory(user-specific) present in the server to the client machine.
Here I dnt knw the content of the directory.I only knw the directory name(which differs from user to user).
Can nyone help me out with coded example?
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
It all depends on the protocol you are using on the server, is it Samba, FTP HTTP, WebDAV?

Possibly the best way to do this is to use the VFS package from Jakarta Commons, changing the protocol you use for this is as simple as changing the URI you use for the directory path.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
R. Roy

Joined: Apr 16, 2006
Posts: 7
I m using HTTP protocol bt cant it be done java programming with thee FILE class object?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60774

Not an advanced Java question.

Since you are using HTTP, I've moved this to the Servlets forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: download file from server
Similar Threads
To perform an action onload of a jsp page only if it meets certain condition
Bluetooth API
How to protect the .jar of my Midlet with a OTA server