note 84212 modified in function.header by danbrown

From: Date: Wed, 30 Jul 2008 18:17:02 +0000
Subject: note 84212 modified in function.header by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142940@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. <?php $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); ?> --was-- 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); http://php.net/manual/en/function.header.php

« previous php.notes (#142940) next »