Question

I have a giant zip which contains no less than 100,000 files. If I need to access a specific file, I have to through this burden:

$zip = zip_open("some.zip".$outFile);
while ($zip_entry = zip_read($zip)) 
{
 //compare the entry against something until I find the one I am looking for 
 // and then.. zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
}

Is there any other way to directly seek the zip file to its nth entry and get the unzipped content?

Thanks

Was it helpful?

Solution

The PHP API (>= 5.2) provides two functions to directly access an entry in a ZIP archive:

http://www.php.net/manual/fr/ziparchive.getfromindex.php http://www.php.net/manual/fr/ziparchive.getfromname.php

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top