Hi All,
the following code (mostly from phpmyadmin source) successfully downloads and unzips the ms-excel/csv file but when i use the back button of the browser (after the download)the compressed zipped code is displayed in the browser (IE) window.
thanks for your help.
lkj
i'm using LAM(ySQL]p{HP] arch. on Compaq Tru64 UNIX V5.1A (Rev. 1885)
php:
$what = 'excel';
$ext;
if ($what == 'csv' || $what == 'excel') {
$ext = 'csv';
$mime_type = 'text/x-csv';
}
$ext .= '.zip';
$mime_type = 'application/x-zip';
$extbis = '.csv';
//if (isset($compression) && $compression == 'zip') {
//if (PMA_PHP_INT_VERSION >= 40000 && @function_exists('gzcompress')) {
$filename = $reportName. $_POST["datasetName"] . "_" . $startYear . "_" . $finishYear;
$zipfile = new zipfile();
$zipfile -> addFile($dump_buffer, $filename . $extbis);
$dump_buffer = $zipfile -> file();
header('Content-Type: ' . $mime_type);
//header('Expires: ' . $now);
//IE need specific headers
if (strstr($_SERVER['HTTP_USER_AGENT'], 'compatible; MSIE ') !== false ) {
header('Content-Disposition: inline; filename="' . $filename . '.' . $ext . '"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Content-Disposition: attachment; filename="' . $filename . '.' . $ext . '"');
header('Pragma: no-cache');
}
echo $dump_buffer;
?>