Friday , 19 December 2014
Home » PHP Framework » CakePHP » Zip Component in CakePHP-Add files in Zip
Zip Component in CakePHP-Add files in Zip

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.

$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.

About Rakshit Patel

I am PHP Freelancer, Rakshit Patel AKA WordPress Freelancer working as PHP Programmer India. I am here to share all my developing knowledge, quick coding techniques, quick solutions to save your time and help you guys for any issue or bug fixing. If you have any PHP, WordPress, Magento related work, please contact me. I am interested for the work.

14 comments

  1. I did not find any Zip Component of CakePHP at given url.

  2. I did not find any Zip Component of CakePHP at given url.

  3. Its Good
    Thanks……

  4. 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

  5. I do not know whether it’s just me or if perhaps everyone else experiencing issues
    with your site. It appears as though some of the written text in
    your content are running off the screen. Can somebody else
    please provide feedback and let me know if this is happening to them as
    well? This could be a issue with my web browser because I’ve had this happen before.

    Many thanks

  6. Thanks , I’ve just been looking for info about this topic for a long time and yours is the best I have discovered till now.

    However, what concerning the conclusion? Are you
    positive concerning the source?

  7. Hey there! I’ve been following your site for some
    time now and finally got the courage to go ahead and give you a shout out from Porter Texas!
    Just wanted to tell you keep up the fantastic work!

  8. Normally I don’t learn article on blogs, but I wish to say that this write-up very pressured me to take a look at
    and do so! Your writing style has been amazed me. Thanks, quite great article.

  9. I read this article fully about the resemblance of most recent and
    previous technologies, it’s awesome article.

  10. After checking out a few of the blog posts on your blog, I
    honestly like your technique of writing a blog. I saved it to my bookmark
    site list and will be checking back soon.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>