Greeting Experts,
I have a php script that queries our db and spits out a csv file in a browser. This work greate in FireFox, Safari, and Chrome. It does not work in Internet Explorer, which is the default browser in our building (sigh). I cannot post the url as it is a protected site and wouldn't do you any good.
In IE I get two popup windows when I click the linke to this report:
1) Unable to download downloads.html from . Unable to open this Internet Site. The request site is either unavailable or cannot be found Please try again later.
2) a downloads % info window: Getting File Information: downloads.html from Estimated time left: Download to: Transfer rate: all these are empty.
So, I have an page, downloads.html trying to produce a CSV file. Not sure what is bombing here as far as IE goes. Are there different headers I can try? I haven't seen any in my searching.
Thanks for any tips...
Here is my function that prints out the data:
# $data is array of data from database
function render_excel($data) {
# headers for browsers
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=file.csv");
header("Pragma: no-cache");
header("Expires: 0");
# column headers
$column_headers = "Filename, Link to File, Details, Unique Viewers\n";
$rows = '';
foreach($data as $foo => $arr){
$rows .= $arr['filename'].",";
$rows .= $arr['resource_url'].",";
$rows .= $arr['detail_url'].",";
$rows .= $arr['distinct_views']."\n";
}
print $column_headers;
print $rows;
}