getCorePath (); require $corePath .'system/control.php'; require $corePath .'extra/pear.php'; require $corePath .'extra/zip.php'; $path = 'instance/'. $name; $file = $instance->getCachePath () . $name .'_'. date ('YmdHmi') .'_'. randomHash (5) .'.zip'; $zip = new Archive_Zip ($file); $files = compress ($path, TRUE); if (!$zip->create ($files, array ('remove_path' => $path))) throw new Exception ('Erro ao tentar criar arquivo Zip: '. $zip->_error_string); sleep (8); $binary = fopen ($file, 'rb'); $buffer = fread ($binary, filesize ($file)); fclose ($binary); @unlink ($file); header('Content-Type: application/force-download'); header('Content-Disposition: attachment; filename='. $name .'_'. date ('YmdHmi') .'.zip'); echo $buffer; exit (); ?>