note 116792 added to function.mime-content-type
| From: | BondAkinmade | Date: | Sun, 01 Mar 2015 14:03:14 +0000 |
| Subject: | note 116792 added to function.mime-content-type | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-201829@lists.php.net to get a copy of this message | ||
using
<?php
function detectFileMimeType($filename='')
{
$filename = escapeshellcmd($filename);
$command = "file -b --mime-type -m /usr/share/misc/magic {$filename}";
$mimeType = shell_exec($command);
return trim($mimeType);
}
?>
should work on most shared linux hosts without errors. Also, it works on Windows hosts with git
installed.
----
Server IP: 216.194.115.244
Probable Submitter: 41.206.15.75
----
Manual Page -- http://php.net/manual/en/function.mime-content-type.php
Edit -- https://master.php.net/note/edit/116792
Del: integrated -- https://master.php.net/note/delete/116792/integrated
Del: useless -- https://master.php.net/note/delete/116792/useless
Del: bad code -- https://master.php.net/note/delete/116792/bad+code
Del: spam -- https://master.php.net/note/delete/116792/spam
Del: non-english -- https://master.php.net/note/delete/116792/non-english
Del: in docs -- https://master.php.net/note/delete/116792/in+docs
Del: other reasons-- https://master.php.net/note/delete/116792
Reject -- https://master.php.net/note/reject/116792
Search -- https://master.php.net/manage/user-notes.php