travisbrown
Technical User
- Dec 31, 2001
- 1,016
I'm trying to force download of a file rather than have the browser handle it.
This is the error I am getting. Below the error is the code I am using. Any help is appreciated.
Response object error 'ASP 0251 : 80004005'
Response Buffer Limit Exceeded
/wwsp/dlfile.asp, line 24
Execution of the ASP page caused the Response Buffer to exceed its configured limit.
<%
Response.Buffer = True
strFileName= request("file") ' Set file name
strFilePath=server.mappath("files/" & strFilename) ' Set path of file
'response.write strFilePath
'response.end
set fso=createobject("scripting.filesystemobject")
set f=fso.getfile(strfilepath)
strFileSize = f.size
set f=nothing: set fso=nothing
Const adTypeBinary = 1
Response.Clear
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath
strFileType = "audio/mpeg3" ' change to the correct content type for your file
Response.AddHeader "Content-Disposition", "attachment; filename=" & strFileName
Response.AddHeader "Content-Length", strFileSize
Response.Charset = "UTF-8"
Response.ContentType = strFileType
Response.BinaryWrite objStream.Read
Response.Flush
objStream.Close
Set objStream = Nothing
%>
This is the error I am getting. Below the error is the code I am using. Any help is appreciated.
Response object error 'ASP 0251 : 80004005'
Response Buffer Limit Exceeded
/wwsp/dlfile.asp, line 24
Execution of the ASP page caused the Response Buffer to exceed its configured limit.
<%
Response.Buffer = True
strFileName= request("file") ' Set file name
strFilePath=server.mappath("files/" & strFilename) ' Set path of file
'response.write strFilePath
'response.end
set fso=createobject("scripting.filesystemobject")
set f=fso.getfile(strfilepath)
strFileSize = f.size
set f=nothing: set fso=nothing
Const adTypeBinary = 1
Response.Clear
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath
strFileType = "audio/mpeg3" ' change to the correct content type for your file
Response.AddHeader "Content-Disposition", "attachment; filename=" & strFileName
Response.AddHeader "Content-Length", strFileSize
Response.Charset = "UTF-8"
Response.ContentType = strFileType
Response.BinaryWrite objStream.Read
Response.Flush
objStream.Close
Set objStream = Nothing
%>