View Full Version : GZIP extract all files?

JAB Creations
08-09-2008, 05:42 AM
I've been browsing the GZIP functions on php.net and I don't see any mention of extracting files from a gz archive on a web server. What function should I be looking for?

JAB Creations
08-09-2008, 06:27 AM
What am I doing wrong with this...?

$filename = "test.gz";
$zd = gzopen($filename, "r");
if (!$zd) {echo 'OPEN: did not work?<br />';}
else {echo 'OPEN: worked?<br />';}

$contents = gzread($zd, 100000);
if (!$contents) {echo 'READ: did not work?';}
else {echo 'READ: worked?';}

08-09-2008, 07:47 AM
gzip only does compression of a single file. Generally multiple files are combined into a single tar archive first. You might find this link (http://www.devshed.com/c/a/PHP/TAR-File-Management-With-PHP-Archive-Tar/) useful.