Solution to a simple requirement: How to allow user to browse/providelocal folder location/path for

Discussion in 'Javascript' started by Radhey Krishna, Jan 27, 2008.

  1. 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
    Radhey Krishna, Jan 27, 2008
    #1
    1. Advertising

  2. Radhey Krishna wrote:
    > How would I create a button which will allow the user to specify where
    > the file to be downloaded will be saved to??


    <form action="file_to_be_downloaded">
    <input type="submit" value="Download">
    </form>

    Or simply set a link. A download dialog will be displayed in either case.

    > 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.


    What do you call a "drop down button" anyway?

    > 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.


    This can't be done without additional features that would grant you
    permission to write to the local filesystem.

    > I thought that this is a simple and decent requirement by the client but
    > I have found no solutions on the web.


    That is why you have not found any solutions so far. Access from a Web site
    to the local filesystem, especially write access, is a security issue, of
    course.

    > So JavaScript developers, please provide some suggestions on how to
    > access the directory path string (which will be used to download the
    > file).


    You can't, at least not interoperably.

    But AFAIK, all available file download dialogs remember the last selected
    directory, so there is not really a need to define the target directory in
    advance.

    However, if your goal is to save the user the additional trouble of
    clicking for each file to be downloaded, why not have a server-side script
    create a zipped archive containing the files selected and then have the user
    download that archive to the target directory using conventional means?

    <form action="zipAll">
    <input type="hidden" name="file" value="file1">
    <input type="hidden" name="file" value="file2">
    <input type="hidden" name="file" value="file3">
    <input type="submit" value="Download as zipped archive">
    </form>


    HTH

    PointedEars
    --
    Prototype.js was written by people who don't know javascript for people
    who don't know javascript. People who don't know javascript are not
    the best source of advice on designing systems that use javascript.
    -- Richard Cornford, cljs, <f806at$ail$1$>
    Thomas 'PointedEars' Lahn, Jan 27, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan
    Replies:
    7
    Views:
    18,505
    catherine sea
    Oct 28, 2010
  2. jef
    Replies:
    1
    Views:
    327
    Joshua Flanagan
    May 7, 2005
  3. =?Utf-8?B?Y2FzaGRlc2ttYWM=?=

    Solution file not in the solution folder

    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=, Sep 12, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    1,084
    Laurent Bugnion
    Sep 12, 2006
  4. Ryan Taylor
    Replies:
    1
    Views:
    662
    Ryan Taylor
    Sep 9, 2004
  5. Replies:
    0
    Views:
    187
Loading...

Share This Page