• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"radkrin",
Please check your private messages.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you looked at the java.util.zip package?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic