koalit
Newbie
Posts: 1
Registered: 9/13/2006
Location: Denmark
Member Is Offline
|
| posted on 9/13/2006 at 05:56 AM |
|
|
Problem zipping a complete folder
Hi.
Just bought the ASPzip object - to make our local intranet make zip archives for our users.
I am trying to create a new zip archive and stream it back to the user. I get no error and it does return a zip archive, only hting is that it's only
356Kb - I assume only headers - no files.
Here's my code that I (mostly) got from the documentation :
Set Zip = Server.CreateObject("SoftComplex.Zip")
'create temporary file name for output zip file
FileName = Zip.GetTempFileName(Server.MapPath(".") & "Temp", "test", ".zip")
'create new zip file
Zip.New(FileName)
Zip.KeepPaths = True
Zip.RelativePaths = FALSE
Zip.SaveEmptyDirectories = True 'if you need to save empty directories
Zip.RootDirectory = strFolderpath '// A correct folder path e.g. "D:data 6-999files"
Zip.FileList.Add("*.*")
Zip.Save
Response.AddHeader "Content-Length", CStr(Zip.Size)
Response.ContentType = "application/x-zip-compressed"
Response.AddHeader "Content-Disposition", "inline; filename="& projectid &".zip"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1 'adTypeBinary
objStream.LoadFromFile FileName
'send zip file to user browser
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
'delete temp zip file
Zip.DeleteFile(FileName)
Response.End
I sure hope that someone out there can help me out.
Thanks,
Mark
|
|
|
wit
Member
Posts: 23
Registered: 11/19/2004
Member Is Offline
|
| posted on 10/10/2006 at 02:40 AM |
|
|
I'm pretty sure your strFolderpath variable has path to invalid or empty folder. It is reason why you get archive with no files in it.
|
|
|