note 66897 deleted from ref.zip by bjori

From: Date: Wed, 31 May 2006 18:30:28 +0000
Subject: note 66897 deleted from ref.zip by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-112671@lists.php.net to get a copy of this message
Note Submitter: Xardas der Dunkle Reason: bad code ---- I have written a small Class in PHP5 for reading a ZIP-File: I hope someone could need it. <?php class zip { public function readZIPFile($filename) { // Declair Vars $i = 0; $array = array(); $zip = @zip_open($filename); // Read ZIP and write it to an Array if($zip): while($entry = zip_read($zip)): $array[$i]['name'] = zip_entry_name($entry); $array[$i]['size'] = zip_entry_filesize($entry); $array[$i]['compressed'] = zip_entry_compressedsize($entry); $array[$i]['method'] = zip_entry_compressionmethod($entry); if(zip_entry_open($zip, $entry, "r")): $array[$i]['content'] = zip_entry_read($entry, zip_entry_filesize($entry)); zip_entry_close($entry); endif; $i++; endwhile; return $array; else: trigger_error("Zip-File couldn't be open!",E_USER_ERROR); return false; endif; } } ?> mfG Xardas

« previous php.notes (#112671) next »