New example for bzip2
| From: | Fernando Correa Da Conceição | Date: | Mon, 10 Feb 2003 00:29:44 +0000 |
| Subject: | New example for bzip2 | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969351686@lists.php.net to get a copy of this message | ||
I make a exemple for bzip2, it takes a file compressed and decompress it, like bzip2 -d does.
Here the code:
<?php
$filebz = "c:\\file.tar.bz2"; //your bzip2 file
$filename = 'c:\\file.tar'; //name to save your file
$bz = bzopen($arquivo, "r");
if (!$fp = fopen($filename, 'wb')) {
print "Error opening file ($filename)";
exit;
}
while($t=bzread($bz)) {
if (!fwrite($fp,$t)) {
print "Error writing to file ($filename)";
exit;
}
}
bzclose($bz);
fclose($fp);
?>
Can I add this example to documentation on bzip2?
The path/filename must be on Linux format?
Thanks
Fernando Correa da Conceição