PHP tutorials,a way to getting some thing new in web

Followers

Powered by Blogger.

Friday 1 August 2014

How to Extract Zip File to specific folder in PHP.

No comments :

We know PHP is very reliable language.IT has many features.One of feature is file.We can extract zip file using php with following code.



<?php
include("ZipArchive.php");
//Create the object
$zip = new ZipArchive();  

// open archive
if ($zip->open('../test1.zip') !== TRUE) {
    die ("Could not open archive");
}

// extract contents to destination directory
$zip->extractTo('../ZIP_extract/');

//Close the archive
$zip->close();   
echo "Archive extracted to ZIP_extract folder!";
?>

No comments :

Post a Comment