Reading files and outputting to browser with correct MIME information

From: Date: Mon, 14 Aug 2000 17:57:28 +0000
Subject: Reading files and outputting to browser with correct MIME information
Groups: php.general 
Request: Send a blank email to php-general+get-11646@lists.php.net to get a copy of this message
Hi all, I am working on a project that involves allowing users to upload their own HTML files and then having the server insert headers and footers, as well as do some other tasks (some logging and other things we need). All file accesses will be directed at a php script via mod_rewrite. What is the best way to output a file to the web browser and send the correct header information, particuarally, the MIME type? Ideally, I'd like to do something like the following chunk of code, but if someone has a better idea of how to go about this, I'm all ears. do_some_stuff(); if($file_is_not_html) { print_file_header_information($theFile) readfile($theFile); } else //html file do_some_other_stuff(); I am not subscribed to the list via this email address, so I would appreciate it if you cc'd me as well as the list. Thanks, John -- John Bafford dshadow@zort.net http://www.dshadow.com/

« previous php.general (#11646) next »