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 EE940D6EDE for ; Tue, 11 Oct 2005 08:02:00 -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 74539-07 for ; Tue, 11 Oct 2005 11:01:50 +0000 (GMT) Received: from mailhub1.sghms.ac.uk (mailhub1.sghms.ac.uk [194.82.51.7]) by svr1.postgresql.org (Postfix) with ESMTP id 6AE5ED6D7A for ; Tue, 11 Oct 2005 08:01:51 -0300 (ADT) Received: from [194.82.51.24] (helo=imail) by mailhub1.sghms.ac.uk with esmtp (Exim 4.24) id 1EPHt1-0005Om-Qj for pgsql-php@postgresql.org; Tue, 11 Oct 2005 12:01:35 +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 <0IO6002N4ZYNCS@imail.sghms.ac.uk> for pgsql-php@postgresql.org; Tue, 11 Oct 2005 12:01:35 +0100 (BST) Date: Tue, 11 Oct 2005 11:58:30 +0100 From: Adam Witney Subject: Automatically opening pdf files stored in a bytea field To: 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=-2.8, required 5, autolearn=not spam, ALL_TRUSTED -3.30, MY_NO_QU 0.50) 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/14 X-Sequence-Number: 3282 Hi, This may be off-topic as regards the database aspect, but im sure people on this list must come across this problem. 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 $sql_data = "SELECT filename, file_data FROM dba_suppl WHERE dba_suppl_id = ".$dba_suppl_id.";"; if($stat2 = execute($sql_data)) { if($rows = pg_numrows($stat2)) { $data = pg_fetch_array($stat2, 0); header("Content-type: application/pdf"); header('Content-Disposition: attachment; filename="'.$data['filename'].'"'); echo pg_unescape_bytea($data['file_data']); } } If I click it it opens acrobat but acrobat gives an error. If I right click the link and save to disk I can open the file from there no problem. As I say, on my mac and on FireFox on windows it does the right thing... Its just IE on windows! Is there something I am forgetting to do here? Or is it just IE and there is no way around it?? Thanks for any help Adam -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.