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

R

RickL

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

Hans

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
 
Y

Yan Roosens

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top