Download file

  • Thread starter Andrew Durstewitz
  • Start date
A

Andrew Durstewitz

Hi!

I am working on a peice of code that will allow a user to download a
file located in the users folder. The file is NOT located inside the
HTTP PUB so I need to use the FSO to stream it to them. For some reason
the code finds the file but the download fails...

ERROR: Internet Explorer cannot download downloadpdf.asp?code=OR1EC1
from mirror.***.com

Internet Explorer was not able to open this Internet site. The
requested site is either unavailable or cannot be found. Please try
again later.

CODE:
Set objFile = objFSO.GetFile(strFileName)
Response.Clear()
Response.AddHeader "Content-Disposition", "attachment; filename=" &
objFile.Name
Response.AddHeader "Content-Length", objFile.Size
Response.ContentType = "application/octet-stream"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
Response.CharSet = "UTF-8"
objStream.LoadFromFile(strFileName)
Response.BinaryWrite(objStream.Read)
objStream.Close
Set objStream = Nothing
Set objFile = Nothing

Thanks,
Andrew J Durstewitz

* * * Sent via DevBuilder http://www.devbuilder.org * * *
Developer Resources for High End Developers.
 
B

Bullschmidt

Don't know if this would help any but I would think that this:
objStream.Type = 1

Should go before this:
objStream.Open

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top