sending HUGE file to client via Response.BinaryWrite

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,
 
M

Mark Schupp

Not familiar with streams so this is mostly a guess but you might try making
sure that the stream's "mode" is set to adModeRead (=1).
 
Z

Zam

Hello Mark,

Unfortunatly, the same negative result (eat all RAM and CPU time):

Error number: -2147024882
Error description: Not enough storage is available to complete this
operation.

Error line: adoStream.LoadFromFile(FPath)

With best regards,
 

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,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top