how to download wmv file

G

Gerald

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

Jeff Dillon

Gerald said:
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
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top