Does anyone have any tips on how to get an existing files mime type? I am trying to read the mime type of all files dumped in a webdav repository and I'm not having much luck.
I checked PHP.net quite deeply, did my googles and searches on PHPclasses - all the references I can find point to form based upload, or mail of some sort.
I need to read the real mime type, not guess the mime-type based on the file extension.
The closest I was able to come was mime.magic, which has shoddy documentation at best, or PECL's file info, which doesn't come compiled.
I also found mime_content_type() but I'm not sure if it directly reads the file for mime_type or guesses based on extension - I don't want someone uploading evilvirus.exe.doc
Any tips (besides compiling file info and using the file extension to get the mime type) before I start thinking about writing some Java?
Cheers,
-Shade
PS: This app is being written in PHP5.
I checked PHP.net quite deeply, did my googles and searches on PHPclasses - all the references I can find point to form based upload, or mail of some sort.
I need to read the real mime type, not guess the mime-type based on the file extension.
The closest I was able to come was mime.magic, which has shoddy documentation at best, or PECL's file info, which doesn't come compiled.
I also found mime_content_type() but I'm not sure if it directly reads the file for mime_type or guesses based on extension - I don't want someone uploading evilvirus.exe.doc
Any tips (besides compiling file info and using the file extension to get the mime type) before I start thinking about writing some Java?
Cheers,
-Shade
PS: This app is being written in PHP5.
