Help! Can't get "Save target as" to work for some file types

Discussion in 'ASP General' started by RickL, Jun 9, 2004.

  1. RickL

    RickL Guest

    I have an ASP application that uploads a specified file to the server. To retrieve the file, I simply assign the filepath and file to a hyperlink on the page. When you click "Save Target As" for some file types, I get the following error messsage: IE can not download <file> from <server>. IE was not able to open this internet site. The requested site is either unavalable or can not be found. Can anyone tell me how to save a file of any type? It works for MS Word, Excell, text files..

    Thanks.
     
    RickL, Jun 9, 2004
    #1
    1. Advertising

  2. RickL

    Hans Guest

    What type of file do you have problems with? Are you sure the file exists?

    You may get a better answer in a html newsgroup since this does not seem to
    be an ASP issue.

    Regards
    /Hans
     
    Hans, Jun 9, 2004
    #2
    1. Advertising

  3. RickL

    Yan Roosens Guest

    Hi Rick,

    > I have an ASP application that uploads a specified file to the server. To retrieve the file, I simply assign the filepath and file to a hyperlink on the page. When you click "Save Target As" for some file types, I get the following error messsage: IE can not download <file> from <server>. IE was not able to open this internet site. The requested site is either unavalable or can not be found. Can anyone tell me how to save a file of any type? It works for MS Word, Excell, text files...


    I'm facing the same problem when I try to download a mdb file. I will start a thread about this issue later today.
    Here is the code I have written so far. It doesn't work for mdb files (the results of the download are always corrupted Access databases), but it could work for the type of file you want to download.

    <%
    Response.ContentType = "text/plain"
    Response.AddHeader "Content-Transfer-Encoding", "binary;"

    ' Fill the Save As field with the name of the file
    Response.AddHeader "Content-Disposition", "attachment; filename=backup.mdb;"

    ' Point to the file to be downloaded
    thepath = server.mappath("/") & "\test\backup.mdb"

    Set fsob = Server.CreateObject("Scripting.FileSystemObject")
    set thefile = fsob.OpenTextFile(thepath)
    response.BinaryWrite(thefile.ReadAll)

    set fsob = Nothing
    set thefile = Nothing
    %>

    Save this code in a Asp page without adding any html tags, and simply call this page to start the download.

    I will keep on working on this code , but I'm afraid I will have to use another solution to download my mdb files (renaming them to zip files)

    HTH
    Yan
     
    Yan Roosens, Jun 12, 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. =?Utf-8?B?cmFuZG1DUA==?=

    Forcing Save target as... dialog

    =?Utf-8?B?cmFuZG1DUA==?=, Jan 24, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    4,885
    =?Utf-8?B?cmFuZG1DUA==?=
    Jan 25, 2005
  2. craig dicker
    Replies:
    1
    Views:
    405
    Peter Rilling
    Jul 10, 2005
  3. ad
    Replies:
    2
    Views:
    749
  4. Soren Kuula
    Replies:
    2
    Views:
    620
    Henry S. Thompson
    Dec 1, 2005
  5. Xeno Campanoli
    Replies:
    1
    Views:
    366
    James Britt
    Jul 1, 2005
Loading...

Share This Page