Jump to content


Photo

How to create a ZIP archive of two files?


  • Please log in to reply
2 replies to this topic

#1 venkir

venkir
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 13 July 2006 - 04:34 AM

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

#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 13 July 2006 - 04:57 AM

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

http://www.zend.com/...view=1#Heading1

Hope That Helps. Good Luck

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 13 July 2006 - 12:33 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users