Created
December 17, 2024 06:32
-
-
Save shohag-cse-knu/517e9cd5f8dfc92f099eb046028bf796 to your computer and use it in GitHub Desktop.
Customer all files are downloaded in a zip with Codeigniter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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