I have a classic ASP web site that needs to allow users to download a large file (CSV, 20 mb). The file is stored outside of the www root folder. I found some code examples on Stackoverflow and other web sites that send the file in chunks but can not get it to work. Both IE and chrome give an error "This webpage is not found".
Here is the entire code that I have for the asp file. What am I doing wrong?
<%@ LANGUAGE=VBScript %>
<%
s_getFile "D:\Data\Dev", "laser2.csv", "laser2"
Sub s_getFile(sPath, sfilename, sBaseName)
Response.Buffer = False
Server.ScriptTimeout = 30000
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; filename=" & sfilename
Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(sPath & "\" & sBaseName)
iSz = adoStream.Size
Response.AddHeader "Content-Length", iSz' may be required
chunk = 2048
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
adoStream.Close
Set adoStream = Nothing
Response.End
End Sub
%>