I
Ilia Makarenko
Hi everyone!
I've got a problem with IIS 6.0 when downloading files with size > 4
Mb. So I am trying to download file in chunks, but it doesn't work.
Only pert of the file is downloaded (~6.5 of 22.5 Mb). Here is the
code:
....
ext = right(filename, 3)
select case ext
case "pdf" ctype= "application/pdf"
case "exe" ctype= "application/octet-stream"
case "zip" ctype= "application/zip"
case "doc" ctype= "application/msword"
case "xls" ctype= "application/vnd.ms-excel"
case "ppt" ctype= "application/vnd.ms-powerpoint"
case "gif" ctype= "image/gif"
case "png" ctype= "image/png"
case "jpg" ctype= "image/jpg"
case else ctype= "application/force-download"
end select
Response.Buffer = False
Response.ContentType = ctype
Response.AddHeader "Content-Disposition", "attachment; filename=" &
f.Name & ";"
buffer_size = 3500000
data_to_read = f.Size
Response.AddHeader "Content-Length", CStr(data_to_read)
do while data_to_read > 0
Response.BinaryWrite ts.Read(buffer_size)
Response.Flush
data_to_read = data_to_read - buffer_size
loop
....
Could anyone tell me what's wrong with the code?
Ilia
I've got a problem with IIS 6.0 when downloading files with size > 4
Mb. So I am trying to download file in chunks, but it doesn't work.
Only pert of the file is downloaded (~6.5 of 22.5 Mb). Here is the
code:
....
ext = right(filename, 3)
select case ext
case "pdf" ctype= "application/pdf"
case "exe" ctype= "application/octet-stream"
case "zip" ctype= "application/zip"
case "doc" ctype= "application/msword"
case "xls" ctype= "application/vnd.ms-excel"
case "ppt" ctype= "application/vnd.ms-powerpoint"
case "gif" ctype= "image/gif"
case "png" ctype= "image/png"
case "jpg" ctype= "image/jpg"
case else ctype= "application/force-download"
end select
Response.Buffer = False
Response.ContentType = ctype
Response.AddHeader "Content-Disposition", "attachment; filename=" &
f.Name & ";"
buffer_size = 3500000
data_to_read = f.Size
Response.AddHeader "Content-Length", CStr(data_to_read)
do while data_to_read > 0
Response.BinaryWrite ts.Read(buffer_size)
Response.Flush
data_to_read = data_to_read - buffer_size
loop
....
Could anyone tell me what's wrong with the code?
Ilia