X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 23ADDD7D46 for ; Wed, 12 Oct 2005 09:32:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85608-02 for ; Wed, 12 Oct 2005 12:32:02 +0000 (GMT) Received: from mailhub2.sghms.ac.uk (mailhub2.sghms.ac.uk [194.82.51.8]) by svr1.postgresql.org (Postfix) with ESMTP id 462D7D7D33 for ; Wed, 12 Oct 2005 09:32:03 -0300 (ADT) Received: from [194.82.51.24] (helo=imail) by mailhub2.sghms.ac.uk with esmtp (Exim 4.24) id 1EPfln-0005Vd-1x; Wed, 12 Oct 2005 13:31:43 +0100 Received: from [172.16.20.3] (mrc1-003.sghms.ac.uk [172.16.20.3]) by imail.sghms.ac.uk (iPlanet Messaging Server 5.2 HotFix 2.06 (built Mar 28 2005)) with ESMTPA id <0IO8007J9YSUG8@imail.sghms.ac.uk>; Wed, 12 Oct 2005 13:31:42 +0100 (BST) Date: Wed, 12 Oct 2005 13:28:37 +0100 From: Adam Witney Subject: Re: Automatically opening pdf files stored in a bytea In-reply-to: <5.2.1.1.0.20051011072754.03649050@pop6.sympatico.ca> To: Frank Bax , pgsql-php Message-id: MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/10.1.1.2418 X-MailScanner-Information: Please contact sysadmin at sghms.ac.uk for more information X-MailScanner-MH2: No Virues detected X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-2.82, required 5, autolearn=not spam, ALL_TRUSTED -2.82) X-MailScanner-From: awitney@sgul.ac.uk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 required=5 tests=[AWL=0.011] X-Spam-Level: X-Archive-Number: 200510/20 X-Sequence-Number: 3288 I sent this but it didn't seem to appear.... > 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. From the link sent by Volkan, adding these header lines fixes the problem header("Pragma: public"); header("Expires: 0"); header("Cache-Control: private"); Thanks for the help guys Adam -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.