using header() to server tiff

From: Date: Thu, 08 May 2003 09:57:16 +0000
Subject: using header() to server tiff
Groups: php.general 
Request: Send a blank email to php-general+get-146813@lists.php.net to get a copy of this message
I'm trying to write an image server script to serve tif/tiff files so that they will open in a browser using an appropriate plug-in. If I just do an href to the file they open fine, however for security reasons we want to keep the files outside the document root. The result is a screen of binary displayed in ascii characters. The code I am using is: <?php $file = "test.tif"; header("Cache-control: private"); header ("Content-Type: image/tiff"); header("Content-Length: ".filesize($file)); header ("Content-transfer-encoding: binary"); header ("Content-Disposition: inline; filename = \"$file\""); $fp = fopen($file, 'rb'); fpassthru($fp); Has anyone had to do this before? Any help gratefully appreciated. Hilary-- Hilary Boyce Enterprise AB Ltd hboyce@eab.co.uk Tel: 01727 751455

« previous php.general (#146813) next »