|
Hi
I'm having a bit of trouble with the script below. I use this to force MP3 files to download instead of open up in a browser. This works fine EXCEPT that it doesn't allow files over 4MB to download. Why is this? If I type the complete file name in the address bar of IE (i.e. "www.mysite.com/download/mysong.mp3"), it downloads fine. Any ideas?
Thanks
M
*****
<%@LANGUAGE="VBSCRIPT"%>
<%
Response.Buffer=true
On Error Resume Next
'Create a stream object
Dim tfm_downloadStream
Set tfm_downloadStream = Server.CreateObject("ADODB.Stream")
tfm_downloadStream.Type = 1
tfm_downloadStream.Open
tfm_downloadStream.LoadFromFile Server.Mappath(Request.Form("FileTitle"))
If Err.number = 0 Then
Response.Clear
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; filename=NewDownload.mp3"
Response.AddHeader "Content-Transfer-Encoding","binary"
Response.BinaryWrite tfm_downloadStream.Read
tfm_downloadStream.Close
Set tfm_downloadStream = Nothing
Response.End()
Else
tfm_downloadStream.Close
Set tfm_downloadStream = Nothing
Response.Redirect("error.asp")
End If
%>
|