EllisLab/CodeIgniter — pull request #757 by narfbg (2011-12-09 11:35:35+00:00)
Title: Improve CI_Upload::_file_mime_type() realiability

This should fix issue #750, although - it's not exactly a bug. List of changes:

- Allowed versions prior to PHP 5.3 to use the Fileinfo extension, as it's possible for it to be available via PECL.
- Changed the Fileinfo extension's use from object-oriented to procedural (as I'm not sure if the OO version was available in the PECL extension) and switched to the `FILEINFO_MIME` flag (`FILEINFO_MIME_TYPE` is only available since PHP 5.3).
- Detection using the `file` command line utility in UNIX-like operating systems now is preferred over the deprecated `mime_content_type()` as even though `file` is not native to PHP - it's way more reliable, if we can use it.
- Switched from `--mime-type` to the `--mime` option (first one might not be available in some environments), for `file` and added `shell_exec()` and `popen()` to the possible interfaces for the command line to use it.
- Generally addressed problems and/or situations [described in issue #750](https://github.com/EllisLab/CodeIgniter/issues/750#issuecomment-3068538).

I'd like to ask @zechdc (or any other volunteer) to test this, as all of the environments that I have available are always up-to-date and I can't really check what could happen on an older system.

Any suggestions and/or thoughts on this are welcome.