This extension is for working with zip. Based on comments to http://www.php.net/manual/en/function.zip-open.php
protected/extensions/zipIntroduce EZip to Yii. Add definition to CWebApplication config file (main.php)
'components'=>array( ... 'zip'=>array( 'class'=>'application.extensions.zip.EZip', ), ... ),
Now you can access EZip methods as follows:
$zip = Yii::app()->zip; $zip->makeZip('./','./toto.zip'); // make an ZIP archive var_export($zip->infosZip('./toto.zip'), false); // get infos of this ZIP archive (without files content) var_export($zip->infosZip('./toto.zip')); // get infos of this ZIP archive (with files content) $zip->extractZip('./toto.zip', './1/'); //
Total 4 comments
Please help me How to download this file, no store in webroot
Thanx for this extension but please use <?php instead <? because if someone has short tags turned off error will occur.
Use DIRECTORY_SEPARATOR, instead of '/' on the line mentioned by the previous post. So it will be similar to this: $this->addZipItem($zip, realpath(dirname($item)).DIRECTORY_SEPARATOR, realpath($item));
I've found a bug in line 48
incorrect: $this->addZipItem($zip, realpath(dirname($item)).'/', realpath($item).'/');
correct: $this->addZipItem($zip, realpath(dirname($item)).'/', realpath($item));
Maybe is useful for others
bye
Leave a comment
Please login to leave your comment.