
 Atef - 2011-05-19 20:32:06
 
<?php
require "zip.class.php"; // Get the zipfile class
$zipfile = new zipfile; // Create an object
$zipfile->read_zip("wordpress_zip.zip"); // Read the zip file
// Now, $zipfile->files is an array containing information about the files
// Here is an example of it's use and extracting files
 
foreach($zipfile->files as $filea)
{
	//creating the directory if not exists
	if(! file_exists($filea['dir']) && trim($filea['dir']) !='' & trim($filea['dir'])  ){
		mkdir($filea['dir'],0777,true);
	}
	
	if (trim($filea['dir']) != '.' &&  trim($filea['dir']) != '' ){
		$dir=$filea['dir'].'/';
	}else{
		$dir=$filea['dir'];
	}
	
	if($filea['name'] != '.'){
	file_put_contents( $dir.$filea['name'],$filea['data']);
	}
}
?>