I am starting to find a lot of ways I could use a recursive zip archiver for php. Point the script to a dir, it zips up the files and preserves the directory structure. And offers it for download.

This is a start, but didn't know if anyone wanted to help put the recursive and directories feature in it.

Here is where I stared my research:

http://us3.php.net/manual/en/ref.zip.php

I didn't see one that wrapped it up nicely.

Trevyn


<?php

$zip = new ZipArchive();
$filename = "./test_zip.zip";



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

//$zip->addFromString("testfilephp.txt" . time(), "#1 This is a test string added as testfilephp.txt.\n");
$zip->addFile($thisdir . "/too.php","/testfromfile.php");
echo "numfiles: " . $zip->numFiles . "br";
echo "status:" . $zip->status . "br";
$zip->close();
?>

<a href="test_zip.zip">Download</a>

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to