Return to Snippet

Revision: 15962
at July 21, 2009 16:11 by fackz

Initial Code

// create object
$zip = new ZipArchive() ;

// open archive
if ($zip->open(’archive. zip’) !== TRUE) {
die (’Could not open archive’);

// extract contents to destination directory
$zip->extractTo(’/ tmp/extracted/ ‘);

// close archive
// print success message
echo ‘Archive extracted to directory’;


Initial URL

Initial Description
A few days ago i was looking for a script witch one will help me to unzip a file using PHP . There is 2 different ways to do it.One just execute a commend to unzip the file in the shell using PHP and another one is using library functions

Initial Title
Unzip file using PHP

Initial Tags
php, file

Initial Language