Jump to content

How to create a ZIP archive of two files?


venkir

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
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.