Sunday, May 29, 2011

Zip Component in CakePHP-Add files in Zip


Hello Friends,
Today i have implemented a Zip functionality in CakePHP. If you want to create an archive file consists of some files to give a download Zip fileoption to user than i might help you to show the steps. Below are the steps how to zip all files and save it to some folder.
$this->Zip->addFile($src_file,$file_name_inzip);
$this->Zip->saveZip(“myzipfile.zip”);
First you can download the file given in link and place above file in components directory in your app/controller folder. Now you can call the function addFile for adding files in zip. Once you will call this function it will read all data from src_file. Now you can save those data to Zip file by calling saveZip function.
If you find any problem in this than let me know by comment.





1 comment:

  1. good day
    It seems the link is broken please let me know where i can get the file

    ReplyDelete