<?php
$filename='test.zip';

if(unzip($filename,"../uploads")){
    @unlink($filename);
}


function unzip($filePath, $path) {
    if (!file_exists($path)) {
        mkdir($path,0777,true);
    }
    if (empty($filePath)) {
        return false;
    }
    $zip = new ZipArchive();
    if ($zip->open($filePath) === true) {
        $zip->extractTo($path);
        $zip->close();
        return true;
    } else {
        return false;
    }
}