View Single Post
Old 10-08-2012, 07:04 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,187
Thanks: 59
Thanked 3,995 Times in 3,964 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
It depends on where your problem is.

If the file is too large to load into the stream with LoadFromFile then there is no easy answer.

If the problem is simply that your Response buffer is too small, then it's fixable.

objStream.Read can take one argument: The number of bytes to read. So you can do this in chunks.

EXAMPLE ONLY:

In place of
Code:
Response.BinaryWrite objStream.Read
you could try doing:
Code:
CONST CHUNK = 100000 ' experiment to get best chunk size
byteCount = objStream.Size
Do While byteCount > CHUNK
    Response.BinaryWrite objStream.Read(CHUNK)
    Response.Flush
    byteCount = byteCount - CHUNK
Loop
Response.BinaryWrite objStream.Read(byteCount)
This is untested code. I remember doing something like this almost 10 years ago, so I'm really dredging this out of vary old human memory. (Both the human and the memory are old.)
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote