Jump to content

Archived

This topic is now archived and is closed to further replies.

venkir

How to create a ZIP archive of two files?

Recommended Posts

Hi:

In my php I am creating two files, both contain the output desired in different format, one in xml and one as plain csv. Let us say they are called abc.xml and abc.csv. These two files are created in a 'uploads' dir in the web server. I would next like to include these two files into a new ZIP archive called 'output.zip' or 'output'gz' (don't care). I read all about the zlib functions, but to me ot looks like when you open the file for writing you can use either fopne or gzopen. My problem is if I use gzopen I will still end up with two files (although they will now be zipped) and I cannot download two files using the 'force donwload' method.

My ultimate aim is when the user clicks 'Save files' the force download method will download the 'output.gz' file, provides capability to the user to save it wherever they want in the local file system. Once they have save and they unzip this file they can extract abc.xml and abc.csv.

How do I do this? Thanks for your time in advance.

-Venki

Share this post


Link to post
Share on other sites
Not sure man. But I have been studing up on this very same thing. Here is a link that maybe of some help

[url=http://www.zend.com/zend/spotlight/creating-zip-files1.php?article=creating-zip-files3&kind=sl&id=2607&open=1&anc=0&view=1#Heading1]http://www.zend.com/zend/spotlight/creating-zip-files1.php?article=creating-zip-files3&kind=sl&id=2607&open=1&anc=0&view=1#Heading1[/url]

Hope That Helps. Good Luck

Share this post


Link to post
Share on other sites
A guy over at smiledsoft.com has written a class for creating compressed archives within PHP. I've used it within several projects, does the job nicely.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.