note 99731 deleted from ref.zip by danbrown

From: Date: Wed, 01 Sep 2010 19:33:00 +0000
Subject: note 99731 deleted from ref.zip by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172252@lists.php.net to get a copy of this message
Note Submitter: soyeum at kumoh dot ac dot kr ---- Thanks to cusimar9@hotmail.com, I could easily fix the problem. I have to compress multiple files, the problem could be solved as follows. <?php require_once("zip.lib.php"); $zip = new zipfile(); // first target file $filename = "files/data1.txt"; $fsize = @filesize($filename); $fh = fopen($filename, 'rb', false); $data = fread($fh, $fsize); $zip->addFile($data, $filename); // second target file $filename = "files/data2.txt"; $fsize = @filesize($filename); $fh = fopen($filename, 'rb', false); $data = fread($fh, $fsize); $zip->addFile($data, $filename); $zipcontents = $zip->file(); echo $zipcontents; ?>

« previous php.notes (#172252) next »