note 42873 deleted from function.header by kennyt

From: Date: Sun, 18 Jul 2004 18:03:06 +0000
Subject: note 42873 deleted from function.header by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73548@lists.php.net to get a copy of this message
Note Submitter: anonymous at ihatespamreallybad dot com ---- Motion's comment about having a "more efficient" header was slightly flawed on my system -- it didn't work for IE until I swapped the two "octet-stream" and "octetstream" lines, as shown below: $f = fopen("file.txt", "rb"); $content_len = (int) filesize("file.txt"); $content_file = fread($f, $content_len); fclose($f); $output_file = 'something.txt'; @ob_end_clean(); @ini_set('zlib.output_compression', 'Off'); header('Pragma: public'); header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 header('Content-Transfer-Encoding: none'); header('Content-Type: application/octet-stream; name="' . $output_file . '"'); //This should work for Non IE/Opera browsers header('Content-Type: application/octetstream; name="' . $output_file . '"'); // This should work for IE & Opera header('Content-Disposition: inline; filename="' . $output_file . '"'); header("Content-length: $content_len"); echo $content_file; exit();

« previous php.notes (#73548) next »