How to extract ZIP / GZIP file using PHP
<?php
$zip = new ZipArchive;
$res = $zip->open('myproject.zip');
if ($res === TRUE) {
$zip->extractTo('/var/www/html/directoryname/');
$zip->close();
echo 'woot!';
} else {
echo 'doh!';
}
?>
Shopify, Shopify Apps, Magento, WordPress, Codeigniter, Joomla, Big Commerce | PHP
<?php
$zip = new ZipArchive;
$res = $zip->open('myproject.zip');
if ($res === TRUE) {
$zip->extractTo('/var/www/html/directoryname/');
$zip->close();
echo 'woot!';
} else {
echo 'doh!';
}
?>
<?php
ini_set('display_errors', 1);
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
$zip->extractTo('./rr/');
$zip->close();
echo "It's extract";
} else {
echo 'failed';
}
?>