File download dialog

Discussion in 'ASP .Net' started by John Spiegel, Apr 16, 2004.

  1. John Spiegel

    John Spiegel Guest

    Hi all,

    How does one allow a user to download a file WITH selecting where it should
    be downloaded to on their machine? Also, when using the WebClient.Download
    method, will the destination path written in Windows format (backslashes,
    etc.) translate across client platforms? Is there a better way?

    WebClient wc = new WebClient();
    wc.DownloadFile(Server.MapPath(@"Downloads\MyFile.pdf"),
    @"C:\Temp\TheirFile.pdf");

    TIA,

    John
    John Spiegel, Apr 16, 2004
    #1
    1. Advertising

  2. John,

    The easiest way to do what you are asking is to just create a link on the
    page pointing to the file to download. (e.g. <a
    href="Downloads/MyFile.pdf">Download MyFile.pdf</a>)

    A link such as this will open a dialog box which will allow a user to open
    or save the file. If they choose save then a dialog box allowing them to
    choose where to save the file will open.

    Since in your example you are using a .pdf file you should also know that,
    depending on the way a user's adobe acrobat reader program is set up the
    file may open in the browser window automatically. However, if they choose
    file - save from the menu they will be able to save the downloaded file
    wherever they want on their drive.

    I hope this helps.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "John Spiegel" <> wrote in message
    news:...
    > Hi all,
    >
    > How does one allow a user to download a file WITH selecting where it

    should
    > be downloaded to on their machine? Also, when using the

    WebClient.Download
    > method, will the destination path written in Windows format (backslashes,
    > etc.) translate across client platforms? Is there a better way?
    >
    > WebClient wc = new WebClient();
    > wc.DownloadFile(Server.MapPath(@"Downloads\MyFile.pdf"),
    > @"C:\Temp\TheirFile.pdf");
    >
    > TIA,
    >
    > John
    >
    >
    S. Justin Gengo, Apr 16, 2004
    #2
    1. Advertising

  3. John Spiegel

    John Spiegel Guest

    Sheesh. So simple, but I couldn't see the forest through the trees!
    Thanks!

    - John

    Please note: I am not as irretrievably stupid as some of my questions might
    make me appear.

    "S. Justin Gengo" <> wrote in message
    news:...
    > John,
    >
    > The easiest way to do what you are asking is to just create a link on the
    > page pointing to the file to download. (e.g. <a
    > href="Downloads/MyFile.pdf">Download MyFile.pdf</a>)
    >
    > A link such as this will open a dialog box which will allow a user to open
    > or save the file. If they choose save then a dialog box allowing them to
    > choose where to save the file will open.
    >
    > Since in your example you are using a .pdf file you should also know that,
    > depending on the way a user's adobe acrobat reader program is set up the
    > file may open in the browser window automatically. However, if they choose
    > file - save from the menu they will be able to save the downloaded file
    > wherever they want on their drive.
    >
    > I hope this helps.
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzsche
    > "John Spiegel" <> wrote in message
    > news:...
    > > Hi all,
    > >
    > > How does one allow a user to download a file WITH selecting where it

    > should
    > > be downloaded to on their machine? Also, when using the

    > WebClient.Download
    > > method, will the destination path written in Windows format

    (backslashes,
    > > etc.) translate across client platforms? Is there a better way?
    > >
    > > WebClient wc = new WebClient();
    > > wc.DownloadFile(Server.MapPath(@"Downloads\MyFile.pdf"),
    > > @"C:\Temp\TheirFile.pdf");
    > >
    > > TIA,
    > >
    > > John
    > >
    > >

    >
    >
    John Spiegel, Apr 16, 2004
    #3
    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. Daniel Cardoso
    Replies:
    1
    Views:
    779
    Daniel Cardoso
    Sep 24, 2004
  2. Ryan Taylor
    Replies:
    2
    Views:
    944
    Ryan Taylor
    Nov 10, 2004
  3. Sam --
    Replies:
    2
    Views:
    608
    Sam --
    Mar 17, 2005
  4. Kele
    Replies:
    0
    Views:
    2,794
  5. =?Utf-8?B?SWJyYWhpbS4=?=

    File name is displayed Garbled in "File download dialog box"

    =?Utf-8?B?SWJyYWhpbS4=?=, Aug 12, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    482
    =?Utf-8?B?SWJyYWhpbS4=?=
    Aug 12, 2006
Loading...

Share This Page