There are other instances when you may upload what you think is an HTML file, but the MIME functions (and the file command) think differently.
The magic.mime system works by looking for strings of text or sequences of characters in your file. If those sequences of characters are not there, you won't get the MIME you expect. We had this situation just recently when we modified our HTML documents and changed the DOCTYPE declaration at the top. Our magic.mime file did not have:
\<!DOCTYPE\ html
It had every other lowercase/uppercase permutation of that, but because it matches it literally, it was casting our HTML documents to text/plain, not text/html.
the solution was to add the line:
- Code: Select all
0 string \<!DOCTYPE\ html text/html
to the magic.mime file and recompile it with:
file -C -m /usr/share/misc/magic.mime (or where ever your MIME file is).
Then restart apache, since the mimetype extension in PHP only reads this file on startup.
Regards,
Jason