forked from bcit-ci/CodeIgniter
-
Notifications
You must be signed in to change notification settings - Fork 4
Unzip
Derek Jones edited this page Jul 5, 2012
·
16 revisions
Category:Library::Zip | Category:Library::Community
Extract ZIP files in CodeIgniter without installing any PECL extensions for PHP.
- PHP 5.1+
- CodeIgniter 1.6.x - 2.0-dev
- ZLib extension enabled
$this->load->library('unzip');
// Optional: Only take out these files, anything else is ignored
$this->unzip->allow(array('css', 'js', 'png', 'gif', 'jpeg', 'jpg', 'tpl', 'html', 'swf'));
// Give it one parameter and it will extract to the same folder
$this->unzip->extract('uploads/my_archive.zip');
// or specify a destination directory
$this->unzip->extract('uploads/my_archive.zip', '/path/to/directory/);