Download file

Discussion in 'ASP General' started by Andrew Durstewitz, Jul 1, 2003.

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

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

    Andrew J Durstewitz

    * * * Sent via DevBuilder * * *
    Developer Resources for High End Developers.
    Andrew Durstewitz, Jul 1, 2003
    1. Advertisements

  2. Andrew Durstewitz

    Bullschmidt Guest

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

    Should go before this:

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
    Bullschmidt, Jul 1, 2003
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.