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 C0D07D6D71 for ; Tue, 11 Oct 2005 16:51: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 16732-09 for ; Tue, 11 Oct 2005 19:51:05 +0000 (GMT) Received: from mailhub1.sghms.ac.uk (mailhub1.sghms.ac.uk [194.82.51.7]) by svr1.postgresql.org (Postfix) with ESMTP id C1184D7758 for ; Tue, 11 Oct 2005 16:51:04 -0300 (ADT) Received: from [194.82.51.24] (helo=imail) by mailhub1.sghms.ac.uk with esmtp (Exim 4.24) id 1EPQ96-0004gW-Mk; Tue, 11 Oct 2005 20:50:44 +0100 Received: from [194.83.225.30] (nomadic-node1-30.sghms.ac.uk [194.83.225.30]) by imail.sghms.ac.uk (iPlanet Messaging Server 5.2 HotFix 2.06 (built Mar 28 2005)) with ESMTPA id <0IO7003YNOGKLO@imail.sghms.ac.uk>; Tue, 11 Oct 2005 20:50:44 +0100 (BST) Date: Tue, 11 Oct 2005 20:47:38 +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-MH1: No virueses detected X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-5.899, required 5, autolearn=not spam, ALL_TRUSTED -3.30, BAYES_00 -2.60) X-MailScanner-From: awitney@sgul.ac.uk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200510/18 X-Sequence-Number: 3286 On 11/10/05 12:30 pm, "Frank Bax" wrote: > 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.