aspose file tools
The moose likes JSP and the fly likes How to allow user to browse/provide local folder location/path for download Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "How to allow user to browse/provide local folder location/path for download " Watch "How to allow user to browse/provide local folder location/path for download " New topic
Author

How to allow user to browse/provide local folder location/path for download

Rama Krishna
Ranch Hand

Joined: Oct 16, 2007
Posts: 110
A very interesting problem for a simple requirement and not easily
available solution:

How would I create a button which will allow the user to specify where
the file to be downloaded will be saved to??

The actual problem is that I have multiple drop down buttons (for
multiple files) with each of the drop down button containing an option
to save to a local folder. Once the user specifies the local path for
each of these files and clicks the submit button. All of the files
will be saved automatically to these locations.

I thought that this is a simple and decent requirement by the client
but I have found no solutions on the web. So JavaScript developers,
please provide some suggestions on how to access the directory path
string (which will be used to download the file).

Thanks and Regards
RadKri
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"radkrin",
Please check your private messages.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

This isn't something you do with in JavaScript.

If you set the Content-Type header to a value for which the browser dosen't have an association, it will automatically prompt the user with a Save or Open With dialog box.

Also, if you set the Content-Disposition header to "attachment", the browser will prompt the user to either open the application with the associated application (if there is one) or save it to disk.

In both cases the user will be given a dialog box that allows them to pick the location on their hard drive to which the file will be saved.
Rama Krishna
Ranch Hand

Joined: Oct 16, 2007
Posts: 110
Unfortunatley, I have many files that will be downloaded in a single click. Do you think this will still solve the problem? So this is still an unsolved problem!

Any other technology I can quickly use, like a script that I can borrow, copy paste and starting using?
[ January 27, 2008: Message edited by: Struts Krishna ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35258
    
    7
The problem of downloading many files in one step can be (more or less) solved by zipping them together into one file for download. Just about every client system can handle .zip files.

As Ben said, neither JSP nor JavaScript can specify the location where a downloaded file will end up. The user can set that in the browser, or in the file save dialog if one is shown. There's nothing the application can do about it.


Android appsImageJ pluginsJava web charts
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56233
    
  13

"Struts Krishna", you have previously been warned on multiple occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional, and this is your final warning. Adjust your display name to comply with the required standards prior to your next post.

Your name must not be obviously fictitious!

Failure to comply will result in the removal of your account.

bear
JavaRanch Sheriff


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Have you looked at the java.util.zip package?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to allow user to browse/provide local folder location/path for download
 
Similar Threads
user to create folder
IBM Exam 157 - Questions and Answers (Sample Exam)
Reading/writing files
problem in unzipping
Need Help for implementing save as dialog box for downloading a folder not a file