[Php-it] download .csv da internet explorer
Riccardo Bini
rick at dualmedia.it
Thu Mar 16 14:36:05 CET 2006
Alle 13:20, giovedì 16 marzo 2006, Marcello Vezzelli ha scritto:
> <?php
> header("Expires: " . gmdate("D, d M Y H:i:s",strtotime("now")-3600*24)
> . " GMT");
> header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
> header("Cache-Control: no-store, no-cache, must-revalidate");
> header("Cache-Control: post-check=0, pre-check=0", false);
> header("Pragma: no-cache");
> header('Content-Disposition: attachment; filename="report.csv"');
> header('Content-Type: application/binary');
> $fc=file_get_contents('c:/dati.csv');
> echo $fc;
> die;
> ?>
Io ho usato questo codice e funziona su IE.
Ciao
Rick
header("Content-type: text/x-comma-separated-values");
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
if (BROWSER_AGENT == 'IE') {
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Pragma: no-cache');
}
header('Content-Disposition: attachment; filename="file.csv"');
echo $var;
exit;
More information about the Php-it
mailing list