asp force download

G

Guoqi Zheng

Dear Sir,

I made a force download in ASP. For other types of file, everything works
ok. but for .txt, .html this kind of file. it always return an error, file
not found. can someone point out what I did wrong here?

The following is my script

strContentType = "application/octet-stream"
abcFile = "filename="&objRs("DocumentName")

response.AddHeader "Content-Disposition", abcFile
response.contenttype=strContentType
response.binarywrite getBinaryFile(FileName)

function getBinaryFile(fileSpec)
Dim adTypeBinary
adTypeBinary = 1
Dim oStream
set oStream = server.createobject("ADODB.Stream")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile= oStream.read
set oStream=nothing
end function


--
Met vriendelijke groet,

Guoqi Zheng
Tel: +31 (0) 23 5343545
http://www.meetholland.com
 
R

Ray at

Guoqi Zheng said:
Dear Sir,

I made a force download in ASP. For other types of file, everything works
ok. but for .txt, .html this kind of file. it always return an error, file
not found. can someone point out what I did wrong here?

What error? And I think you should be returning those file types as
"adTypeText" (2).

Ray at home
 
G

Guoqi Zheng

The error I got is "page not found", I don't really understand it. I will
try to test by adTypeText
Thanks
 

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
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top