note 17890 deleted from ref.zip by jimw
| From: | jimw@php.net | Date: | Wed, 02 Jan 2002 12:19:28 +0000 |
| Subject: | note 17890 deleted from ref.zip by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24274@lists.php.net to get a copy of this message | ||
Big thanks to vangoethem@hotmail.com for the zip.lib.php tip!
FYI, here's a sample chunk of code for those who want to use it:
<?
require('zip.lib.php');
Header("Content-type: application/x-zip");
Header("Content-Disposition: attachment; filename=foo.zip");
$zipfile = new zipfile();
$handle=opendir(".");
while ($filename = readdir($handle)) {
if (is_file($filename)) {
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
$zipfile -> addFile($contents, $filename);
}
}
closedir($handle);
echo $zipfile -> file();
?>