Comment 67 for bug 1249858

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

Wow, that was a lot of code! So here's what we wound up doing:

1. Added some logic that tries different magicdb locations at install or upgrade time. If it finds one that works, it stores that in a config option and always uses that one. If it finds that none work, then it won't try to use fileinfo in the future.

2. Added a config-defaults.php option for advanced users to specify a different magic db location.

3. Added a parameter to file_mime_type() that allows it to get the original (uploaded) name of the file, so that if fileinfo doesn't work we can check the file's extension.

4. Changed the upload code so that it trusts file_mime_type() more than it trusts the browser-supplied mimetype