how to download wmv file

Discussion in 'ASP General' started by Gerald, Aug 18, 2008.

  1. Gerald

    Gerald Guest

    I want the user to be able to download WMV files. I get an error with the
    following code.
    Any suggestions appreciated

    Gerald


    MY CODE
    <%
    Response.ContentType = "application/xunknown"
    Response.AddHeader "content-disposition","attachment;
    filename=http://www.facethewind.com/videos/may29_01.mpg"
    set adoStream = Server.CreateObject("ADODB.Stream")
    adoStream.Type = 1
    vUrl = "URL=http://www.facethewind.com/videos/may29_01.mpg"
    chunk = 2048
    adoStream.Open vUrl, adModeRead
    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 adoStream.Read(iSz Mod chunk)
    End If
    End If
    Response.Flush
    adoStream.Close
    Set adoStream = Nothing
    Response.End

    %>

    ERROR MESSAGE
    Internet Explorer cannot download testdownload.asp from www.test.com
    Internet Explorer was not able to open this Internet site. The requested
    site is either unavailable or cannot be found.
     
    Gerald, Aug 18, 2008
    #1
    1. Advertising

  2. Gerald

    Jeff Dillon Guest

    "Gerald" <> wrote in message
    news:%...
    >I want the user to be able to download WMV files. I get an error with the
    >following code.
    > Any suggestions appreciated
    >
    > Gerald
    >
    >
    > MY CODE
    > <%
    > Response.ContentType = "application/xunknown"
    > Response.AddHeader "content-disposition","attachment;
    > filename=http://www.facethewind.com/videos/may29_01.mpg"
    > set adoStream = Server.CreateObject("ADODB.Stream")
    > adoStream.Type = 1
    > vUrl = "URL=http://www.facethewind.com/videos/may29_01.mpg"
    > chunk = 2048
    > adoStream.Open vUrl, adModeRead
    > 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 adoStream.Read(iSz Mod chunk)
    > End If
    > End If
    > Response.Flush
    > adoStream.Close
    > Set adoStream = Nothing
    > Response.End
    >
    > %>
    >
    > ERROR MESSAGE
    > Internet Explorer cannot download testdownload.asp from www.test.com
    > Internet Explorer was not able to open this Internet site. The requested
    > site is either unavailable or cannot be found.
    >


    Any reason not to use just an <a href..> link? Right click, Save Target
    As...

    Jeff
     
    Jeff Dillon, Aug 19, 2008
    #2
    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. RJT
    Replies:
    1
    Views:
    3,027
    Daniel Fisher\(lennybacon\)
    Jan 17, 2005
  2. Yousuf Khan
    Replies:
    5
    Views:
    5,518
    Yousuf Khan
    Oct 18, 2004
  3. Rob Vanheuckelom
    Replies:
    3
    Views:
    2,695
    Travis Newbury
    Apr 15, 2005
  4. Arthur Shapiro
    Replies:
    1
    Views:
    511
    Spartanicus
    Aug 15, 2005
  5. Mahla
    Replies:
    1
    Views:
    414
    Thomas Matthews
    Jan 19, 2005
Loading...

Share This Page