note 84212 added to function.header

From: Date: Thu, 03 Jul 2008 15:34:55 +0000
Subject: note 84212 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-141117@lists.php.net to get a copy of this message
To get PHP to load a PDF (for example) from file, use the following code. $filename = $_SERVER['DOCUMENT_ROOT'] . "/path/to/file/my_file.pdf"; header("Cache-Control: public"); header("Content-Description: File Transfer"); header('Content-disposition: attachment; filename='.basename($filename)); header("Content-Type: application/pdf"); header("Content-Transfer-Encoding: binary"); header('Content-Length: '. filesize($filename)); readfile($filename); ---- Server IP: 209.41.74.194 Probable Submitter: 198.45.18.48 ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- https://master.php.net/note/edit/84212 Del: integrated -- https://master.php.net/note/delete/84212/integrated Del: useless -- https://master.php.net/note/delete/84212/useless Del: bad code -- https://master.php.net/note/delete/84212/bad+code Del: spam -- https://master.php.net/note/delete/84212/spam Del: non-english -- https://master.php.net/note/delete/84212/non-english Del: in docs -- https://master.php.net/note/delete/84212/in+docs Del: other reasons-- https://master.php.net/note/delete/84212 Reject -- https://master.php.net/note/reject/84212 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141117) next »