note 34112 added to function.header

From: Date: Wed, 16 Jul 2003 15:05:34 +0000
Subject: note 34112 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-52201@lists.php.net to get a copy of this message
To be binary safe, don't send the \n ! After testing the downloaded files with md5 their checksum was always wrong. After removing the \n their checksum was correct again. Tested with MS IE 6sp1, Opera 7.02, Mozilla 1.3.1 (on Windows XP) Here is the code: --cut-- header('Pragma: public'); header('Cache-Control: private'); header('Cache-Control: no-cache, must-revalidate'); header('Accept-Ranges: bytes'); header('Content-Length: ' . $file_size); header('Connection: close'); if ($mime_type) header("Content-Type: $mime_type"); header('Content-Disposition: attachment; filename=' . $file); readfile($file); --cut-- Note: By using "attachment" instead of "inline" the MSIE was smart enough to download the files and not open them always. ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34112 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34112&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34112&report=yes

« previous php.notes (#52201) next »