20 January, 2011

Unzip files with PHP

This example shows how to unzip files in PHP. It also unpacks large files.

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

No comments:

Post a Comment