[UPHPU] I hate MSIE!
Steve Dibb
steve at wonkabar.org
Thu Sep 14 17:25:55 MDT 2006
C. Ed Felt 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;
> ?>
>
Have you tried something like this?
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=export.csv');
and then just echoing out the CSV?
Btw, save some memory and reference the session so as to not store it twice.
$CSV =& $_SESSION["csv"];
Steve
More information about the UPHPU
mailing list