Return to Snippet

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


Initial Code
<?php

// 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
$zip->close();
echo ‘Archive extracted to directory’;

?>

Initial URL
http://ranacse05.wordpress.com/2008/03/20/unzip-file-using-php/

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
PHP