I use the follwoing code to push a large ZIP file to the client using vbscript (Classic asp). I am not sure how objStream.Read(10240)
works? Does it send data to the client in chunks (or loads the file in memory chunks)? Should I also use Response.buffer= true
(or false?) or those chunks with response.flush
automatically release the server buffer size?
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1 'adTypeBinary
objStream.Open
objStream.LoadFromFile(server.mappath("test.zip"))
Response.ContentType = "application/zip"
Response.Addheader "Content-Disposition", "attachment; filename=test.zip"
do while not objStream.EOS
response.binarywrite objStream.Read(10240)
Response.Flush
loop