Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shohag-cse-knu/517e9cd5f8dfc92f099eb046028bf796 to your computer and use it in GitHub Desktop.
Save shohag-cse-knu/517e9cd5f8dfc92f099eb046028bf796 to your computer and use it in GitHub Desktop.
Customer all files are downloaded in a zip with Codeigniter
<?php
function download_zip($customer_id=NULL){
$this->load->library('zip');
$this->load->helper('file');
$query = $this->db->query("SELECT * FROM customers WHERE customer_id = $customer_id")->row();
$path ='customer_files/';
$arr_file = explode(',', $query->cust_file);
foreach ($arr_file as $a_file) {
$this->zip->read_file($path.$a_file,TRUE);
//$this->zip->read_file($path.$a_file,FALSE); //Folder Directory won't be added
}
$this->zip->download("all_customer_files");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment