Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Problem zipping a complete folder
koalit
Newbie

Posts: 1
Registered: 9/13/2006
Location: Denmark
Member Is Offline
posted on 9/13/2006 at 05:56 AM Reply With Quote
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:data6-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
View User's Profile View All Posts By User U2U Member
wit
Member

Posts: 23
Registered: 11/19/2004
Member Is Offline
posted on 10/10/2006 at 02:40 AM Reply With Quote

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.
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Free Download Free Download
Product Documentation Documentation
Documenation Page
Code Samples
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004