1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
<?php
session_start();
$zip = new ZipArchive();
$dos = "PARIS";
if($zip->open('PARIS') == TRUE){
if($zip->open('PARIS.zip', ZipArchive::CREATE) == TRUE){
if ($lister == opendir($dos)){
while (false !== ($file = readdir($lister))) {
if ($file != '.' && $file != '..' && strrchr($file,".")=='.jpg'){
$diapo[] = $file;
$zip->addFile('$diapo[]');
}
}
closedir($lister);
}
header('Content-Type: application/zip');
header('Content-Disposition: attachment;filename="PARIS.zip"');
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public");
header("Expires: 0");
readfile('PARIS.zip');
}
}else{
echo 'Impossible d'ouvrir "Zip.zip"';
}
?> |
Partager