Comment 1 for bug 1249858

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Since none of the standard PHP built-in's is acceptable at the moment for properly identifying a file's mimetype, I suggest we use Moodle's code for it. Moodle has a couple of functions in lib/filelib.php for identifying mime types based on file extension:

get_mimetypes_array(): https://github.com/moodle/moodle/blob/master/lib/filelib.php#L1387

mimeinfo(): https://github.com/moodle/moodle/blob/master/lib/filelib.php#L1594

The get_mimetypes_array() method has a pretty exhaustive list of mimetypes. The downside to this is that it's an external library, so we'll have to check periodically to keep it up to date. It would probably be best if this is just a temporary measure until the problems with PHP's mimetype functions get resolved.