Motyar

@motyar

Freelance Web Developer

Static Web Hosting, made easy

Mar 23, 2010

Zip with Php

Every time when you search for the code "How to create zip file with php" OR "Zipping with Php", You will easily found a class or a long code snippet. I think If your are searching for the basic idea, You are at right place.

Code

PHP
<?php
$zip = new ZipArchive();
// use ZIPARCHIVE::OVERWRITE if you want to owerwrite files
$zip->open('my.zip',ZIPARCHIVE::CREATE); 
// add file names, comma separated
$zip->addFile('file1.txt','file2.php'); 
$zip->close();
?>

Labels:




By :