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: Zipping files from different folders

Posts: 1
Registered: 3/14/2007
Member Is Offline
posted on 3/14/2007 at 04:47 PM Reply With Quote
Zipping files from different folders

Hi. Just bought AspZip and finding extremely useful. Struggling a bit with zipping multiple files from different folders into one zip though.

'create temporary file name for output zip file
FileName = Zip.GetTempFileName(Server.MapPath("zipFolder"), "test", ".zip")

'create new zip file

'set root folder
Zip.RootDirectory = Server.MapPath("images/")

'add files to archive

'save zip file
FileCount = Zip.Save

If I use this code all images have to be in the images folder. I tried resetting the root folder after each FileList.Add but just got 2nd image in zip.

I want to be able to loop through a list of images and 'collect them' from several places in the site.

Any help much appreciated.
Stilts :)
View User's Profile View All Posts By User U2U Member

Posts: 23
Registered: 11/19/2004
Member Is Offline
posted on 3/14/2007 at 06:18 PM Reply With Quote

To add files from different folders just use absolute file paths when you add them to file list


'create new zip file

'add files to archive
Zip.FileList.Add(Server.MapPath("images/") & "pic.jpg")
Zip.FileList.Add(Server.MapPath("anotherfolder/") & "anotherpic.jpg")

'save zip file
FileCount = Zip.Save
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