note 83162 modified in ref.zip by danbrown

From: Date: Sun, 25 Oct 2009 13:09:01 +0000
Subject: note 83162 modified in ref.zip by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-162053@lists.php.net to get a copy of this message
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; ?> --was-- 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: $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; http://php.net/manual/en/ref.zip.php

« previous php.notes (#162053) next »