Save

Navigation:  Development > Function Reference > Module > Zip >

Save

Previous pageReturn to chapter overviewNext page

Used to create Zip archive by manually adding file and folder. There are two add method addDir, addFile. See bellow example

 

$zip  = App::Module('Zip')
    ->setFileName(App::Config()->baseDir("/uploads/pics.zip"))
    ->addDir('pics')
    ->addFile(App::Config()->baseDir("/uploads/Winter.jpg"),  'uploads/Winter.jpg')
    ->save(true);

 

If we pass true in save function then file automatically download after zip done.  The above example a new zip file create with the name of wikipedia.zip and after extract wikipedia.php will found in wikipedia folder.