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 file option 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.
php?type=snippet&id=317″ rel=”nofollow” target=”_blank”>Download Zip Component
$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.






I am
about 1 year ago
Already available.
https://cakeforge.org/snippet/detail.php?type=snippet&id=185
about 1 year ago
Already available.
https://cakeforge.org/snippet/detail.php?type=snippet&id=185
about 1 year ago
I did not find any Zip Component of CakePHP at given url.
about 1 year ago
I did not find any Zip Component of CakePHP at given url.
about 1 year ago
Its Good
Thanks……
about 1 year ago
Thanks for the post . it was helpful, but when i tried to zip files with large size got the error ” Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 42299447 bytes) ”
Hoping for a good answer
about 8 months ago
http://bakery.cakephp.org/articles/SeanCallan/2007/07/18/zip-component
about 8 months ago
http://bakery.cakephp.org/articles/SeanCallan/2007/07/18/zip-component