note 85879 added to function.mime-content-type

From: Date: Mon, 22 Sep 2008 18:46:32 +0000
Subject: note 85879 added to function.mime-content-type
Groups: php.notes 
Request: Send a blank email to php-notes+get-144620@lists.php.net to get a copy of this message
Lukas V is IMO missing some point. The MIME type of a file may not be corresponding to the file suffix. Imagine someone would obfuscate some PHP code in a .gif file, the file suffix would be 'GIF' but the MIME would be text/plain or even text/html. Another example is files fetched via a distant server (wget / fopen / file / fsockopen...). The server can issue an error, i.e. 404 Not Found, wich again is text/html, whatever you save the file to (download_archive.rar). His provided function should begin by the test of the function existancy like : function MIMEalternative($file) { if(function_exists('mime_content_type')) return mime_content_type($file); else return <lukas_v.MIMEfunction>($file); } ---- Server IP: 213.246.51.26 Probable Submitter: 82.230.254.25 ---- Manual Page -- http://www.php.net/manual/en/function.mime-content-type.php Edit -- https://master.php.net/note/edit/85879 Del: integrated -- https://master.php.net/note/delete/85879/integrated Del: useless -- https://master.php.net/note/delete/85879/useless Del: bad code -- https://master.php.net/note/delete/85879/bad+code Del: spam -- https://master.php.net/note/delete/85879/spam Del: non-english -- https://master.php.net/note/delete/85879/non-english Del: in docs -- https://master.php.net/note/delete/85879/in+docs Del: other reasons-- https://master.php.net/note/delete/85879 Reject -- https://master.php.net/note/reject/85879 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144620) next »