A
Anil Gupte
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
(e-mail address removed)
www.keeninc.net
www.icinema.com
--
Anil Gupte
k.e.e.n., inc.
Milwaukee, WI
(e-mail address removed)
www.keeninc.net
www.icinema.com
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
(e-mail address removed)
www.keeninc.net
www.icinema.com
--
Anil Gupte
k.e.e.n., inc.
Milwaukee, WI
(e-mail address removed)
www.keeninc.net
www.icinema.com