Download vs. Play

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
 
R

Ray Costanzo [MVP]

Does your IUSR_computer-name account have NTFS permissions to access that
file?

Ray at work
 

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

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top