Thursday, September 4, 2014

Extracting ZIP file directories in PHP

Here is the code.

<?php  $toDir= getcwd();
$fromFile = "joomlacomponent.zip";
if (!file_exists($toDir))
mkdir($toDir, 0777);
if (class_exists('ZipArchive', false))
{
$zip = new ZipArchive();
if ($zip->open($fromFile) === true AND $zip->extractTo($toDir) AND $zip->close())
return true;
return false;
}
die();
?>

No comments:

Post a Comment