Re: Automatically opening pdf files stored in a bytea - Mailing list pgsql-php

From Frank Bax
Subject Re: Automatically opening pdf files stored in a bytea
Date
Msg-id 5.2.1.1.0.20051011072754.03649050@pop6.sympatico.ca
Whole thread Raw
In response to Automatically opening pdf files stored in a bytea field  (Adam Witney <awitney@sgul.ac.uk>)
Responses Re: Automatically opening pdf files stored in a bytea
Re: Automatically opening pdf files stored in a bytea
Re: Automatically opening pdf files stored in a bytea
List pgsql-php
At 06:58 AM 10/11/05, Adam Witney wrote:
>I have PDF files stored in a bytea field in the database and I want to all
>the user to click a link on the web page and have the file automatically
>opened in acrobat (or whatever they have set to read the pdf). It works for
>most browsers except for in Internet Explorer on windows (surprise
>surprise!). Here is my code
>
>          header("Content-type: application/pdf");
>          header('Content-Disposition: attachment;
> filename="'.$data['filename'].'"');


Here's mine...
         if(isset($_SERVER['HTTP_USER_AGENT']) &&
                         strpos($_SERVER['HTTP_USER_AGENT'],'MSIE'))
                 header('Content-Type: application/force-download');
         else
                 header('Content-Type: application/octet-stream');
         header('Content-Length: '.strlen($this->buffer));
         header('Content-disposition: attachment; filename="'.$name.'"');


But on a some systems (both Win98 & WinXP), user must save/open instead of
open directly - haven't figured out why yet.


pgsql-php by date:

Previous
From: Adam Witney
Date:
Subject: Automatically opening pdf files stored in a bytea field
Next
From:
Date:
Subject: Re: Automatically opening pdf files stored in a bytea