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.


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


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.


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.


  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?


Leave a Reply

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