note 83162 deleted from ref.zip by danbrown
| From: | danbrown@php.net | Date: | Wed, 29 Jun 2011 15:25:36 +0000 |
| Subject: | note 83162 deleted from ref.zip by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181045@lists.php.net to get a copy of this message | ||
Note Submitter: cusimar9 at hotmail dot com
----
Just to second the comments above and say that the zipfile class in phpMyAdmin is excellent.
There are 2 files when you download phpMyAdmin:
\libraries\zip.lib.php
\libraries\unzip.lib.php
Here is a small example:
<?php
$zip = new zipfile();
$filename = "1.jpg";
$fsize = @filesize($filename);
$fh = fopen($filename, 'rb', false);
$data = fread($fh, $fsize);
$zip->addFile($data,$filename);
$zipcontents = $zip->file();
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"TheZip.zip\"");
header("Content-length: " . strlen($zipcontents) . "\n\n");
// output data
echo $zipcontents;
?>