Z
Zam
Hello World,
Under Windows 2003 Server. IIS6.
The following code working fine for small files, and for files with size
about few megabytes.
If I am trying to send HUGE file -- about 700 Megabyte -- w3wp.exe eat all
memory (I have 1024 megabytes) and all CPU time without positive result.
Question: how could i _clever_ and fast send very huge file to client, with
keeping "file location privacy" ?
<%
Response.Buffer = False
Server.ScriptTimeout = 30000
Response.ContentType = "application/x-unknown"
fn = "movie1.avi"
FPath = "g:\movies\" & 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
%>
With best regards,
Under Windows 2003 Server. IIS6.
The following code working fine for small files, and for files with size
about few megabytes.
If I am trying to send HUGE file -- about 700 Megabyte -- w3wp.exe eat all
memory (I have 1024 megabytes) and all CPU time without positive result.
Question: how could i _clever_ and fast send very huge file to client, with
keeping "file location privacy" ?
<%
Response.Buffer = False
Server.ScriptTimeout = 30000
Response.ContentType = "application/x-unknown"
fn = "movie1.avi"
FPath = "g:\movies\" & 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
%>
With best regards,