How can I extract .zip (100%), using PHP?
If you have zziplib installed, you can use this code:
<?php
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
$zip->extractTo('/my/destination/dir/');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
Make sure the user executing php (usually nobody, apache or httpd) have writing privileges on destination dir.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With