×
Home About Us Products Services News Free Scripts Contact
news php scripts and software

PHP example - How to open a zip file and read its contents?


PHP - How to open a zip file and read its contents?

resource zip_open ( string filename)

The idea of the zip_open() function is to load in a zip file and interate through its contents 

<?php 

$zp = zip_open("/myfiles/blah.zip"); 

while($zipFile = zip_read($zip)) 
{ 
echo "Filename: " . zip_entry_name($zipFile) . "<br>"; 
echo "Compressed Size: " . zip_entry_compresedsize($zipFile) . "<br>"; 
echo "Real Size: " . zip_entry_filesize($zilFile) . "<br><br>"; 
} 

?>


(You must have the ZZIPlib library installed along with PHP before zip_open() will work.)

Category: PHP

 
<< Go back