Home Tutorial Php Examples Read a zip file.

 
 

Read a zip file.
Posted on: July 30, 2009 at 12:00 AM
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);
?>

Related Tags for Read a zip file.:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.