[UPHPU] contact-disposition: attachment serves inline anyway

Wade Preston Shearer wadeshearer.lists at me.com
Fri Sep 18 09:50:56 MDT 2009


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);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2431 bytes
Desc: not available
Url : http://uphpu.org/pipermail/uphpu/attachments/20090918/d0f116d5/attachment.bin 


More information about the UPHPU mailing list