Use the following code to unzip the zip file using php code:
<?php
function unzip($location,$newLocation){
if(exec(“unzip $location”,$arr)){
mkdir($newLocation);
chmod($newLocation,0777);
for($i = 1;$i< count($arr);$i++){
$file = trim(preg_replace(“~inflating: ~”,””,$arr[$i]));
chmod($file,0777);
copy($file,$newLocation.’/’.$file);
//
unlink($file);
}
return TRUE;
}else{
return FALSE;
}
}
?>
//Use the code as following:
<?phpif(unzip(‘zip-file.zip’,’unZipFile’))
echo ‘Success!’;
else
echo ‘Error’;
?>
Hope that this will be useful.





If you interested to write an article on 9lessons as a guest author plz send the document.