We were called in to help someone with a failing file upload feature on a PHP website.
It turned out that we’d recently upgraded their server to debian 5.0 and the mime_content_type() PHP function was no longer available.
This isn’t a serious bug really, because the function has been deprecated (old PHP lives forever, but not so function definitions) for some time. Debian bug #491033 gives the details.
We put together a fairly quick fix using shell_exec() to call the file command (with the usual checks to avoid someone poisoning the shell – which shouldn’t happen because it’s only called on uploaded temporary filenames, but why risk it?). We could have used finfo_file but that’s not yet packaged for debian, so is it worth the cost of having unpackaged PHP classes around?
hi,
I would suggest to use fileinfo instead. It can be used with 5.2 as well and is bundled in 5.3+. Much better (and safer for file validation).
fileinfo is finfo_file isn’t it? Bundled in 5.3+… I’m sure that wasn’t on the top of the manual page when I looked at it last time, but now it is. Cool.
And php 5.3.0 is in experimental already…