<?PHP
// Create the md5 hash for naming purposes;
$zipname = md5($somename_probably_user_provided);
// create object
$zip = new ZipArchive();
// open archive
if ($zip->open($zipname, ZIPARCHIVE::CREATE) !== TRUE) {
die ("Could not open archive");
}
// list of files to add
// list of files to add
$fileList = array(
'fstab2.php',
'images/branch.gif',
'files/php1.php'
);
// add files
foreach ($fileList as $f) {
$zip->addFile($f) or die ("ERROR: Could not add file: $f");
}
// close and save archive
$zip->close();
echo "Archive created successfully.";
?>