Download vs. Play

Discussion in 'ASP General' started by Anil Gupte, Nov 11, 2004.

  1. Anil Gupte

    Anil Gupte Guest

    My original question had to do with forcing a download instead of play for a
    known mime type. I got some useful pointers, but, I failed. Can someone
    tell me what is going wrong in this code?

    <%
    Response.Buffer = False
    Server.ScriptTimeout = 30000

    Response.ContentType = "application/x-unknown" ' arbitrary
    fn = "raigarh.wmv"
    FPath = "e:\icinema.com\movies\raigarh\" & fn
    Response.AddHeader "Content-Disposition", "attachment; filename=" & fn

    Set adoStream = CreateObject("ADODB.Stream")
    chunk = 2048
    adoStream.Open()
    adoStream.Type = 1
    adoStream.LoadFromFile(FPath)

    iSz = adoStream.Size

    Response.AddHeader "Content-Length", iSz

    For i = 1 To iSz \ chunk
    If Not Response.IsClientConnected Then Exit For
    Response.BinaryWrite adoStream.Read(chunk)
    Next

    If iSz Mod chunk > 0 Then
    If Response.IsClientConnected Then
    Response.BinaryWrite objStream.Read(iSz Mod chunk)
    End If
    End If

    adoStream.Close
    Set adoStream = Nothing

    Response.End
    %>

    I copied this from http://www.aspfaq.com/show.asp?id=2161 and saved it to a
    file called download.asp However, when I click on the link to Download.asp,
    it says it "cannot download download.asp". On Windows XP I do not get even
    that, just a page cannot be displayed message.

    Please help, I am desperate now!

    Thanx,
    --
    Anil Gupte
    k.e.e.n., inc.
    Milwaukee, WI

    www.keeninc.net
    www.icinema.com


    --
    Anil Gupte
    k.e.e.n., inc.
    Milwaukee, WI

    www.keeninc.net
    www.icinema.com
    Anil Gupte, Nov 11, 2004
    #1
    1. Advertising

  2. Is E: a local drive on the server?

    Ray at home

    "Anil Gupte" <> wrote in message
    news:...
    > My original question had to do with forcing a download instead of play for
    > a known mime type. I got some useful pointers, but, I failed. Can
    > someone tell me what is going wrong in this code?
    >
    > <%
    > Response.Buffer = False
    > Server.ScriptTimeout = 30000
    >
    > Response.ContentType = "application/x-unknown" ' arbitrary
    > fn = "raigarh.wmv"
    > FPath = "e:\icinema.com\movies\raigarh\" & fn
    > %>
    >
    > I copied this from http://www.aspfaq.com/show.asp?id=2161 and saved it to
    > a file called download.asp However, when I click on the link to
    > Download.asp, it says it "cannot download download.asp". On Windows XP I
    > do not get even that, just a page cannot be displayed message.
    Ray Costanzo [MVP], Nov 11, 2004
    #2
    1. Advertising

  3. Anil Gupte

    Anil Gupte Guest

    Yes, it is the same drive that the .asp file is on.

    --
    Anil Gupte
    k.e.e.n., inc.
    Milwaukee, WI

    www.keeninc.net
    www.icinema.com
    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:...
    > Is E: a local drive on the server?
    >
    > Ray at home
    >
    > "Anil Gupte" <> wrote in message
    > news:...
    >> My original question had to do with forcing a download instead of play
    >> for a known mime type. I got some useful pointers, but, I failed. Can
    >> someone tell me what is going wrong in this code?
    >>
    >> <%
    >> Response.Buffer = False
    >> Server.ScriptTimeout = 30000
    >>
    >> Response.ContentType = "application/x-unknown" ' arbitrary
    >> fn = "raigarh.wmv"
    >> FPath = "e:\icinema.com\movies\raigarh\" & fn
    >> %>
    >>
    >> I copied this from http://www.aspfaq.com/show.asp?id=2161 and saved it to
    >> a file called download.asp However, when I click on the link to
    >> Download.asp, it says it "cannot download download.asp". On Windows XP I
    >> do not get even that, just a page cannot be displayed message.

    >
    >
    Anil Gupte, Nov 12, 2004
    #3
  4. Does your IUSR_computer-name account have NTFS permissions to access that
    file?

    Ray at work

    "Anil Gupte" <> wrote in message
    news:...
    > Yes, it is the same drive that the .asp file is on.
    >
    > --
    > Anil Gupte
    > k.e.e.n., inc.
    > Milwaukee, WI
    >
    > www.keeninc.net
    > www.icinema.com
    > "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    > message news:...
    >> Is E: a local drive on the server?
    >>
    >> Ray at home
    >>
    >> "Anil Gupte" <> wrote in message
    >> news:...
    >>> My original question had to do with forcing a download instead of play
    >>> for a known mime type. I got some useful pointers, but, I failed. Can
    >>> someone tell me what is going wrong in this code?
    >>>
    >>> <%
    >>> Response.Buffer = False
    >>> Server.ScriptTimeout = 30000
    >>>
    >>> Response.ContentType = "application/x-unknown" ' arbitrary
    >>> fn = "raigarh.wmv"
    >>> FPath = "e:\icinema.com\movies\raigarh\" & fn
    >>> %>
    >>>
    >>> I copied this from http://www.aspfaq.com/show.asp?id=2161 and saved it
    >>> to a file called download.asp However, when I click on the link to
    >>> Download.asp, it says it "cannot download download.asp". On Windows XP
    >>> I do not get even that, just a page cannot be displayed message.

    >>
    >>

    >
    >
    Ray Costanzo [MVP], Nov 12, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ryan Taylor
    Replies:
    2
    Views:
    945
    Ryan Taylor
    Nov 10, 2004
  2. Steve C. Orr [MVP, MCSD]
    Replies:
    0
    Views:
    1,616
    Steve C. Orr [MVP, MCSD]
    Mar 7, 2005
  3. Sam --
    Replies:
    2
    Views:
    608
    Sam --
    Mar 17, 2005
  4. nospam
    Replies:
    13
    Views:
    883
    André Gillibert
    Nov 18, 2007
  5. Anil Gupte

    Download vs. play?

    Anil Gupte, Nov 7, 2004, in forum: ASP General
    Replies:
    7
    Views:
    139
    Ray Costanzo [MVP]
    Nov 11, 2004
Loading...

Share This Page