logo       


Automatically opening pdf files stored in a bytea field: msg#00013

Subject: Automatically opening pdf files stored in a bytea field
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.


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org



Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe