Hi!
I am trying to find the MIME type of a file, but the results I am getting are quite confusing. I am running Ubuntu 8.04.
The file with which I am testing is an OpenOffice writer file. My code is as follows:
- * $handle = finfo_open(FILEINFO_MIME);
- * print(finfo_file($handle,$filename) . "\n");
This outputs "application/x-zip" which is clearly wrong or at least useless. If I, however, do a mimetype command in the console, the correct result is shown:
- * application/vnd.oasis.opendocument.text
Running mimetype in debug mode, reveals the magic file used:
- * Hashing magic from /usr/share/mime/magic
Trying now to let finfo use that magic file, however, returns an error:
- * $handle = finfo_open(FILEINFO_MIME, '/usr/share/mime/magic');
Outputs:
- * Warning: finfo_open(): Failed to load magic database at '/usr/share/mime/magic'.
Has anyone run across this error before?
Yours sincerely
Rasmus