Ask a Question related to ASP, Design and Development.

  1. #1

    Default Download file

    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 [url]http://www.devbuilder.org[/url] * * *
    Developer Resources for High End Developers.
    Andrew Durstewitz Guest

  2. Similar Questions and Discussions

    1. File Download
      Assuming I had some file(s) which i wanted posted on the web for other web viewers to download. How do i accomplish this. Can also reply at...
    2. ASP File download
      Hello. I have a site developed. Throughout the site there are downloads littered throughout. They link to pdf's. What I need to do is create a...
    3. Download a file
      Hello, I would like that a user can download a file starting from a server and that the user could place it where he wants. (sorry I'm a French guy...
    4. File Download?
      Hello, a great problem for me is to download a file by other account than the logon user. I change the identity -> int usertoken; bool LoginOK...
  3. #2

    Default Re: Download file

    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
    [url]http://www.Bullschmidt.com[/url]
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Bullschmidt Guest

  4. #3

    Default Download file

    I uploaded a pdf file to my web site and created the link with a flash
    button but when I try to open the pdf file from IE appear the following
    messagge (I translated from the italian message):

    Impossible download file "namefile.pdf " from web site "namewebsite".
    Impossible to open the web site. Web site non available or not found

    Anybody know what it means? Maybe I have made some kind of mistake bun I
    cannot understand what.
    Any kind of help will be very appricieted.

    Regards
    Marco


    Marco Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139