Netscape downloading with a .php extension added on to file
Posted: Wed Feb 18, 2004 3:50 pm
<?
session_start();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: text/comma-separated-values");
header("Content-Disposition: attachment; filename=\"results.csv\"");
$i = $_SESSION['allresults_count'];
$array = $_SESSION['allresults'];
$a = 0;
echo("Rec Number,Sales,Employees,Sic,Sic extention,Name,State,Zip,Zip extention,County,Census Tract,Bank Fimp,Branch\n");
while($a < $i)
{
reset($array[$a]);
while(list($key, $val) = each($array[$a]))
{
echo('="' . $val . '"');
echo(",");
}
echo("\n");
$a++;
}
?>
I'm using this to generate a .cvs file on the fly to be downloaded from data collected in $_SESSION['allresults'].... IE handles it fine, but netscape wants to add a .php so it becomes results.cvs.php... I am using the same set of headers as I use for downloading .xls files (obviously Content-Type is different, but otherwise the same) so I was wondering if anyone knew what is causing this.
session_start();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: text/comma-separated-values");
header("Content-Disposition: attachment; filename=\"results.csv\"");
$i = $_SESSION['allresults_count'];
$array = $_SESSION['allresults'];
$a = 0;
echo("Rec Number,Sales,Employees,Sic,Sic extention,Name,State,Zip,Zip extention,County,Census Tract,Bank Fimp,Branch\n");
while($a < $i)
{
reset($array[$a]);
while(list($key, $val) = each($array[$a]))
{
echo('="' . $val . '"');
echo(",");
}
echo("\n");
$a++;
}
?>
I'm using this to generate a .cvs file on the fly to be downloaded from data collected in $_SESSION['allresults'].... IE handles it fine, but netscape wants to add a .php so it becomes results.cvs.php... I am using the same set of headers as I use for downloading .xls files (obviously Content-Type is different, but otherwise the same) so I was wondering if anyone knew what is causing this.