Sunday, 22 May 2016

Extract zip file using PHP script

Following is PHP code to extract zip file on current position. 

<?php

$file = 'zip_filename.zip';
$path = './zip/';

$zip = new ZipArchive;
if ($zip->open($file) === TRUE) {
    $zip->extractTo($path);
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}

?>

No comments:

Post a Comment