Unzip/Extract an uploaded file using php
by Sanju[ Edit ] 2010-06-24 18:03:20
Here is a simple which helps you to Unzip/Extract an uploaded file using php
<?php
$zip = new ZipArchive;
$res = $zip->open('zip_file_name.zip');
if ($res === TRUE) {
$zip->extractTo('dir_name/');
$zip->close();
echo 'Extracted';
} else {
echo 'Failed to Extract';
}
?>
Basically it extracts the zip file into the directory you specify… make sure the directory you want to extract it to has write permissions.