Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Help! Can't get "Save target as" to work for some file types

Reply
Thread Tools

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

 
 
RickL
Guest
Posts: n/a
 
      06-09-2004
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.
 
Reply With Quote
 
 
 
 
Hans
Guest
Posts: n/a
 
      06-09-2004
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


 
Reply With Quote
 
 
 
 
Yan Roosens
Guest
Posts: n/a
 
      06-12-2004
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in setting Target Node and Target Tree Property mohit ASP .Net 0 01-23-2008 05:41 AM
Need help, get error "Object does not match target type" in one instanceof an app, when others work Lasse Vågsæther Karlsen ASP .Net 1 11-27-2007 02:46 PM
How to get the target of a Windows shortcut file Steve M Python 1 05-06-2006 01:13 AM
Hi I am new to asp i can not get it to work on xp pro sp2 even though the localhost work but asp pages dont so can some one help craig dicker ASP .Net 9 07-07-2005 11:52 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM



Advertisments