Gauthier | Bonjour,
Voila j'ai un script qui me génère un script et qui force le download. Celui-ci fonctionne tres bien avec firefox masi avec IE6 il m'affiche un message d'erreur mais je ne comprends pas pourquoi.
l'exemple est a cette adresse : http://staging.uniteloverval.be/download.php?idAlbum=1
Code :
- require('include/lib_zip.php');
- $fichier_zip ="zip.zip"; // nom du fichier zip que l'on veut
- $zip = new zipfile();
- $path = "photos"; // repertoire que l'on veut zipper
- function zipDir($path,&$zip){
- if(!is_dir($path))return;
- if(!($dh=@opendir($path))){
- return;
- }
- while($file=readdir($dh)){
- if($file=="."||$file==".." )continue; // Throw the . and .. folders
- if(is_dir($path."/".$file)){ // Recursive call
- zipDir($path."/".$file,$zip,$i);
- }elseif(is_file($path."/".$file)){ // If this is a file then add to the zip file
- $zip->addFile(file_get_contents($path."/".$file),$path."/".$file);
- }
- }
- }
- zipDir($path,$zip);
- $filezipped = $zip->file(); // On recupere le contenu du zip dans la variable $filezipped
- header('Content-type: application/zip');
- header('Content-Disposition: attachment; filename="telechargement.zip"');
- echo $filezipped;
|
Merci d'avance |