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 how to download files to predefined directory at user's local PC? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to download files to predefined directory at user Watch "how to download files to predefined directory at user New topic

how to download files to predefined directory at user's local PC?

Michael L. Zhang
Ranch Hand

Joined: Jul 06, 2003
Posts: 33
We need build something in our java web application to download a zip file from server , and we like to control the directory where the files can be downloaded by our users. What we really like is to save the zip file from server and unzip it to a predefined directory at user's local PC, eg. C:\download.

I like to know what kind of java technology or approach is good to perform such task. On server side, we will create a zip file for each different user. In our jsp page, we will display a message letting user download and save the zip file to a predefined local directory at his/her local disk. But we do not want the user do something like mouse right click and "Save As", since we have no way to control the directory the files are downloaded to.

I know this is a strange requirement to many of you. Just FYI: We are building an offline course player and we like user play a course in offline mode, and we will resynchronize the course tracking data back to server once he/she reconnects to the network. To control the local directory path will make the resynchronizing much easier.

Your input is greatly appreciated.

BTW: This is a web application built only for our company's internal users. So, let us assume there are no security concern as seen in normal web application.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Unfortunately, Web applications suffer from all sorts of "security" issues. Even when you are writing for clients in your own company, you still fall foul of features (and non-features) that are in Web browsers to protect against bad guys.

If the client side of your application is in JavaScript, I believe you cannot do arbitrary file operations like you want. The Web browser very definitely does not want Web applications doing stuff to the local file system, outside the control of the user.

If your client side were an applet, and you managed to get sufficient privileges given to the applet, then maybe...

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
I agree. Here's the link:
subject: how to download files to predefined directory at user's local PC?
jQuery in Action, 3rd edition