Header Nightmare...

From: Date: Wed, 22 Aug 2001 07:31:31 +0000
Subject: Header Nightmare...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-63872@lists.php.net to get a copy of this message
Who can crack the following nut for me..? Or is it uncrackable...? I have some files stored in a MySQL database... I encoded this data using base64_encode.. These files can be anything from .pdf files to .jpg or even a Word document... To make these files visible I made the following code: include ("config/database.cfg"); //config file to connect to database etc etc... $result = mysql ($databasename, "select * from image_table where id = '$admin[file]'"); $nrrows = mysql_numrows($result); if ($nrrows == 1) {$row = mysql_fetch_array($result); header("Content-type: $row[type]"); header("Content-Disposition: inline; filename=$row[originalname]"); echo (base64_decode($row[data])); exit; } O.K, heres the problem... Basically the above example works for all documents which Explorer 5.5 (which I am testing on) has got built-in support for.. All documents which use an external application/plugin are giving problems! On the moment I am experimenting with .PDF files... My problems is binary data (of the pdf) showing up in my browser.. (E.g... It looks as if the normal html/text tag is used for the content... I need explorer to start Acrobat to view this page... The idea that I get, is that I named the above script: retrieve_date.htm I have got a feeling that Explorer 5.5 is still very buggy with the headers, especially when the filename you retrieve hasn't got the same extension as the filename will original be... Does anyone see any mistakes which I am making... ? With kind regards David Bouw

« previous php.general (#63872) next »