Create a Zip File Using PHP and Download Multiple Files

Demo Download

Today i am sharing how to create a zip file of multiple files using PHP and download that zip file on click. For this purpose i will need a folder where all files are available which can be selected and downloaded. I will also create a single php page which contain the following scripts.

HTML

Create a simple PHP page and copy paste the below form.

jQuery

Add the following script in footer of web page. Don’t forget to add jQuery library before this script.

As you can see above that when you click on select all, all checkboxes are checked or unchecked. You can see my tutorial about how to select deselect all checkboxes using jquery.

PHP

Copy paste the below PHP script in the top of web page. When someone submit form first we are checking if files array is set or not, then we are creating zip file and downloading that file.

Demo Download

If you found this tutorial helpful so share it with your friends, developer groups and leave your comment.

Article By
Javed Ur Rehman is a passionate blogger and web developer, he loves to share web development tutorials and blogging tips. He usually writes about HTML, CSS, JavaScript, Jquery, Ajax, PHP and MySQL.

9 Comments

  1. Just what I am looking for!
    And no javascript…yay

    However the php is being stripped from my page. Would that be a server setting? What version of php does the script need on the server?

    thanks

Leave a Reply

Your email address will not be published. Required fields are marked *