if (isset($_GET["grouped"])) {
    if (isset($_POST['selection'])) {
        $paths = array();
        foreach ($_POST['selection'] as $md5) {
            $paths[] = getPathForMD5Chain(DOWNLOADS_DIR, $md5);
        }
        doZipGrouped($paths);
    } else {
        throw new Exception("No selection provided.");
    }
} else {
    $path = getPathFromURL();
    if (is_zip($path)) {
        doUnzip($path);
    } else {
        if (is_rar($path)) {
            doUnrar($path);
        } else {
            if (is_dir($path)) {
                doZip($path);
            } else {
                $warning = "Impossible de traiter le fichier <b>" . basename($path) . "</b>, ce n'est ni une archive ZIP/RAR ni un dossier.";
            }
        }
    }
}
?>

<html>
	<head>
		<title>Compression/D&eacute;compression de fichier</title>
Exemple #2
0
function isCompressedArchive($filePath)
{
    return is_zip($filePath) || is_rar($filePath);
}