Tech Arise

Create and Download Zip File using CodeIgniter

A ZIP file is an archive that contains one or more files or directories compressed. Zip files make it easy to keep related files or directories together and make transporting, e-mailing, downloading, and storing data and software faster and more efficient. In this tutorial, We have share how to Create and Download Zip Files using CodeIgniter zip library. This example demonstrates how to compress a file, save it to a folder on your server, and download your computer.
Step 1: load class
The Zip class is initialised in your controller using the $this->load->library function:
Once loaded, the Zip library object will be available using:
Step 2: Create a controller file
Next create a controller file named “Zipfile.php” inside “application/controllers” folder.
Step 3: Create a view file
Create a view file named “index.php” inside “application/views/zipfile folder
Exit mobile version