Initializing the Class
$this->load->library('zip');
Usage Example
This example demonstrates how to compress a file, save it to a folder on your server, and download it to your desktop.
<?php if (!defined ('BASEPATH')) exit ('No direct access allowed');
class Zip extends CI_Controller
{
public function index()
{
$this->load->library('zip');
$this->load->helper('directory');
$map = directory_map('./upload images/index gallery/');
$size = sizeof($map);
for($i=0; $i<$size; $i++){
$this->zip->read_file('./upload images/index gallery/'.$map[$i]);
}
$this->zip->download('my_backup.zip');
}
}
?>