[UPHPU] I hate MSIE!
David Boucha
boucha at gmail.com
Fri Sep 15 08:10:42 MDT 2006
On 9/14/06, C. Ed Felt <ed at thefelts.net> wrote:
> Fellow PHP developers:
>
> I have an annoying little issue with CSV files, mime types and IE and I
> was wondering if any of you have suggestions.
>
> There is nothing secret here so here is the PHP code I am using to pull
> a CSV page from a buffer ($_SESSION["csv"]) to a browser. This code
> works fine in Mozilla (of course) but is broken in MSIE (as usual):
> The url is (not available to you of course):
> http://panel_test.localhost/csvout.php
>
> <?php
> session_start();
> header('Content-Type: application/txt');
> $CSV = $_SESSION["csv"];
> $name = $_SESSION["fileName"];
> header('Content-Length: '.strlen($CSV));
> header('Content-disposition: inline; filename="'.$name.'"');
> echo $CSV;
> ?>
>
<-- snip -->
>
> I am at my wits end on this one. I was just wondering if any of you
> have any ideas. Unfortunately I am working in a Windows only shop, so I
> have to get this to work with the WIN32 version of Apache and MSIE (6),
> (the only case that doesn't work).
>
Ed,
This is what I do in an app here at work. It works on Win2000/XP with
Intenet Exploder 6
I do a database query that places the column names in $header, then
puts the info in $data.
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=BudgetReport.xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data";
exit();
This creates an Excel download. I think it's really just a csv file
that I've arbitrarily given the .xls extension so my users don't get
confused. It's been a couple years since I wrote this code, but it's
working on an internal app.
Dave
More information about the UPHPU
mailing list