note 71082 deleted from function.fpassthru by nlopess

From: Date: Sat, 11 Nov 2006 20:09:43 +0000
Subject: note 71082 deleted from function.fpassthru by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-119611@lists.php.net to get a copy of this message
Note Submitter: simon at paragi.dk ---- This code is usefull to controle access to files other then HTML, that the browser know how to show. <?php // Find mime type if(function_exists('mime_content_type')) $content_type=mime_content_type($file_name); else $content_type=trim(exec('file -bi '.escapeshellarg($file_name))); // Send header header('Content-Type: '.$content_type); // Pass file $fp = fopen($file_name, 'rb'); fpassthru($fp); fclose($fp); ?> Simon at http://paragi.com

« previous php.notes (#119611) next »