Jeff, thanks, I looked at yours which appears to be asp.net, rewrote mine a
bit, this modified code downloads the file with the correct size..
interesting, I'm guessing it's the clear and flush around the binary write..
'Set the content type to the specific type that you are sending.
Set objFilesystem =
Server.CreateObject("Scripting.FileSystemObject")
Set objFilestream = objFilesystem.GetFile(downloadPath)
intFilelength = objFilestream.size
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile downloadPath
Response.Clear
Response.ContentType = "octet-stream" '"application/zip"
Response.AddHeader "Content-Disposition", "attachment; filename=" &
downloadFile
Response.AddHeader "Content-Length", intFilelength
Response.BinaryWrite objStream.Read(intFileLength)
Response.Flush
Response.End
objStream.Close
Set objStream = Nothing
"Jeff Dillon" <je**@removeemergencyreporting.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I'm doing similar with similar sized files...my code is:
MyFileStream = New FileStream(pathspec & filespec, FileMode.Open)
FileSize = MyFileStream.Length
Dim Buffer(CInt(FileSize)) As Byte
MyFileStream.Read(Buffer, 0, CInt(FileSize))
MyFileStream.Close()
Response.BufferOutput = True
Response.ContentType = "application/asp-unknown"
Response.AddHeader("content-disposition", "attachment; filename=" &
filespec)
Response.BinaryWrite(Buffer)
Response.Flush()
Response.End()
Jeff
"Derrick" <de*********@excite.com> wrote in message
news:Oh**************@TK2MSFTNGP09.phx.gbl... I have an http download that streams a zip file to client, after
download I am getting "Error [file name] start of central directory not found; Zip file corrupt. Possible casue: file transfer error."
Ring any bells? Here's the asp code, thanks in advance!!
Derrick
...
Response.ContentType = "application/zip"
Response.AddHeader "Content-Disposition", "attachment;
filename=" & downloadFile
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile downloadPath
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
Response.End