How to allow user to browse/provide local folder location/path for download
Rama Krishna
Ranch Hand
Joined: Oct 16, 2007
Posts: 110
posted
0
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).
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
posted
0
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
posted
0
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.
"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.