note 61272 added to function.header

From: Date: Mon, 30 Jan 2006 02:00:52 +0000
Subject: note 61272 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-102701@lists.php.net to get a copy of this message
I too was also having a problem getting my files to be displayed properly in IE, mainly on a PC though. In Firefox on OS X 10.4.4 it was working fine, and clicking on the link brought up a dialog box asking whterh I wanted to open or save the file. In Safari 2.0.3 it automatically displayed within Preview embedded in the browser window. On a PC however, it couldn't determine the type of file nor open it properly and would always insist on downloading it first. Anyway, heres the headers I sent that made it work properly (display within Acrobat within the browser). if (is_readable($fileloc)){ header("Pragma: public"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: must-revalidate"); header("Content-type: application/pdf"); header("Content-Length: ".filesize($file)); header("Content-disposition: inline; filename=$filename"); header("Accept-Ranges: ".filesize($file)); readfile($file); exit; } Many thanks to the note below for some(most!) of the code! Cheers. ---- Server IP: 203.220.0.235 Probable Submitter: 129.180.1.224 (proxied: 129.180.101.59) ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61272 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61272&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61272&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61272&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61272&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61272&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61272&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61272&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61272&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102701) next »