J
James Whitehead
I have the following code which works fine downloading smaller files, the
trouble is most of the files to be downloaded are large. With large files it
just returns a HTTP 500 error.
Any ideas how to get this to work. I have tried to split the download into
chunks but it just timesout.
Set objFile = objFSO.GetFile(strFileName)
'-- first clear the response, and then set the appropriate headers
Response.Clear
'-- the filename you give it will be the one that is shown
' to the users by default when they save
Response.AddHeader "Content-Disposition", "attachment; filename=" &
strFileName
Response.AddHeader "Content-Length", objFile.Size
Response.ContentType = "application/octet-stream"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
'-- set as binary
objStream.Type = 1
Response.CharSet = "UTF-8"
'-- load into the stream the file
objStream.LoadFromFile(strFileName)
'-- send the stream in the response
Response.BinaryWrite(objStream.Read)
Response.Flush
objStream.Close
Set objStream = Nothing
Set objFile = Nothing
trouble is most of the files to be downloaded are large. With large files it
just returns a HTTP 500 error.
Any ideas how to get this to work. I have tried to split the download into
chunks but it just timesout.
Set objFile = objFSO.GetFile(strFileName)
'-- first clear the response, and then set the appropriate headers
Response.Clear
'-- the filename you give it will be the one that is shown
' to the users by default when they save
Response.AddHeader "Content-Disposition", "attachment; filename=" &
strFileName
Response.AddHeader "Content-Length", objFile.Size
Response.ContentType = "application/octet-stream"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
'-- set as binary
objStream.Type = 1
Response.CharSet = "UTF-8"
'-- load into the stream the file
objStream.LoadFromFile(strFileName)
'-- send the stream in the response
Response.BinaryWrite(objStream.Read)
Response.Flush
objStream.Close
Set objStream = Nothing
Set objFile = Nothing