I'm struggling with an odd error. I have a simple web app that grabs stuff from a DB then outputs it as a downloadable csv file. It works on firefox and chrome, but IE fails to recognize it as a csv file (thinking it is a html fle) and when I click save I get the error, "Unable to download {name of file} from {name of site}. Unable to open this internet site. ..."
Code:
session_start();
//some logic goes here...
//generate csv header
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=exportevent.csv");
header("Pragma: no-cache");
header("Expires: 0");
echo "Event: " . $event_title . "
";
//print the column names
echo "Last Name, First Name, Company
";
while($row = mysql_fetch_assoc($result))
{
echo $row['atlname'] . ',' . $row['atfname'] . ',' . $row['atcompany'] . "
";
}
I've played around with the content-type a whole bunch, but that had no effect.
Update: I've tried text/csv, application/vnd.ms-excel (and variations of this), text/plain, and some others that I now forget with no luck.
This is IE8 btw.
Update 2: The connection is over SSL.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…