Wednesday, 29 May 2013

How to unziped a directory using php

Extract a Zip File Using PHP

   In my previous post i had posted how you can make a zip file in Php. But i know many of you are also looking to unzip a zip file in php. So here i am back with the solution.



CODE : (PHP SIMPLE CODE TO EXTRACT A ZIPED DIRECTORY)



<?php
$zip = new ZipArchive;
if ($zip->open('rex.zip') === TRUE) {
    $zip->extractTo('res/');
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}
?>

No comments:

Post a Comment