Home Tutorial Php Examples Read a zip file.

 
 

Share on Google+Share on Google+
Read a zip file.
Posted on: July 30, 2009 at 12:00 AM
Advertisement
zip_entry_read() example

zip_entry_read()

In this example the function zip_entry_read() will help in reading a zip file. First select a file to be opened. Name that file into zip file and direct the zipread command to read it through while loop. The zip_entry_read command will read one byte at a time. when it reads all the contents, it will executed and file will be closed. 

<?php
$zipname = zip_open("new1.zip");
if ($zipname){ 
while($zipcontent = zip_read($zipname)){
echo zip_entry_name($zipcontent);
if (zip_entry_open($zipname, $zipcontent)){ 
$content = zip_entry_read($zipcontent,1024);
echo "Contents : ".$content;
zip_entry_close($zipcontent);
}
}
}
zip_close($zipname);
?>

Advertisement

Related Tags for Read a zip file.:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 30, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com