File is corrupt when downloaded
Posted on 2006-06-27
I have a folder that contains a zip file. If I open the file directly, it opens just fine.
I use this code I found here on EE from Sybe:
sFilePath = "C:\sites\Single44\sam\webroot\secret_folder\Color Particle Logo.zip"
sContentType = "application/zip"
sDisplayName = "Test download.zip"
Set oStream = Server.CreateObject("ADODB.Stream")
oStream.Type = 1
Response.ContentType = sContentType
Response.AddHeader "Content-Disposition", "attachment; filename=" & sDisplayName
Response.AddHeader "Content-Length", oStream.Size
Set oStream = Nothing
The file downloads, but won't open ("It does not appear to be a valid archive").
The original and downloaded files are the same size.
Not sure what the problem is. Lots of people seem to be using this code with lots of success.