If I remember right, the webserver determines a lot about whether
something is served 'inline' or as a download.  You might want to
check how your web server is handling csv (or mime in general) on your
test server vs your production server.

David Landry

On Fri, Sep 18, 2009 at 9:50 AM, Wade Preston Shearer
<[email protected]> wrote:
> On 18 Sep 2009, at 9:19, Randy Moller wrote:
>
>> I recently modified the report module of our backoffice software
>> application to serve up a content-disposition: attachment csv on demand
>> instead of actually creating a tmp file and a link to it (optimization).
>> It's being served in an ssl environment. The problem is, on our test
>> server, this process works as advertised (save dialog), but in
>> production, the disposition is being ignored (all browsers), and the
>> content is being served inline and dumped to the browser anyway. It's a
>> pretty standard header arrangement (below). Obviously, there must be
>> some difference on the server side, but no luck in finding it so far.
>>
>> Has anyone had a similar issue that can shed some light?
>>
>> header("Content-type: text/x-csv");
>> header("Content-Length: ".strlen($csv_raw_output));
>> header("Content-Disposition: attachment; filename=".$filename);
>> print $csv_raw_output;
>> exit;
>
> Here is what I use (I can share my entire script if you want to know what
> the variables contain):
>
> ini_set('zlib.output_compression', 'Off');
> header('Content-Description: File Transfer');
> header('Content-Type: ' . $ctype);
> header('Content-Disposition: attachment; filename="' . basename($file) .
> '"');
> header('Content-Transfer-Encoding: binary');
> header('Expires: 0');
> header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
> header('Pragma: public');
> header('Cache-Control: private', false);
> header('Content-Length: ' . $filesize);
>
>
>
> _______________________________________________
>
> UPHPU mailing list
> [email protected]
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
>

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to