Create a zip file with PHP


SUBMITTED BY: amsaid

DATE: Aug. 8, 2016, 3:30 p.m.

FORMAT: PHP

SIZE: 219 Bytes

HITS: 645

  1. <?php
  2. $zip = new ZipArchive();
  3. $zip->open('path/to/zipfile.zip', ZipArchive::CREATE);
  4. $zip->addFile('some-file.pdf', 'subdir/filename.pdf');
  5. $zip->addFile('another-file.xlxs', 'filename.xlxs');
  6. $zip->close();

comments powered by Disqus