Source Code

How Create a Zip File Using PHP

  • midhun pottmmal
  • 18 November 2013 at 13:45
  • PHP
  • 278
  • 108
  • United States

Author: midhun pottmmal Language: United States
License: Freeware
Size: 0 KB
Downloads: 31 times


Hello friends now we are going to discus a small code for creating Zip file using PHP. Creating zip file is simple as comparing with author languages.

PHP have a very useful class called ZipArchive ,To create multiple zip files in this post i will show you how create a ZIP file


function zipFilesDownload($file_names,$archive_file_name,$file_path)
    $zip = new ZipArchive();

    if ($zip->open($archive_file_name, ZIPARCHIVE::CREATE )!==TRUE) {
        exit(cannot open <$archive_file_name>n);

    foreach($file_names as $files)

    header(Content-type: application/zip);
    header(Content-Disposition: attachment; filename=$archive_file_name);
    header(Pragma: no-cache);
    header(Expires: 0);


comments powered by Disqus

Related Code

Icon Extractor - full delphi source code

Func-In Delphi Example

Create Search and Get in The Middle String

PHP Script for PING


PHP Sample From CSUSB

Bootstrap UI Kits

Diagram Studio

Simple Graph Component

Delphi Example Code