Home | Scripts | Tutorials | Books | Hosting | Forums | Links|

Navigation:

Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Books
Sample Chapters
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links






 
 

SPONSORS



 
 

Extract contents of a zip file

This example shows how to extract the contents of a zip file to a folder. this uses the excellent pclzip library which does all the hard work for you.

<?php
//download library from http://www.phpconcept.net/pclzip/index.en.php#download
include('pclzip.lib.php');
//zip file to extract
$archive = new PclZip('printerport1.zip');
//extract to a folder called newdir
if ($archive->extract(PCLZIP_OPT_PATH, 'newdir') == 0)
{
//failed
die("Error : ".$archive->errorInfo(true));
}
echo "Successfully extracted files;
?>