filetype() in php?

Associate
Joined
16 May 2005
Posts
680
All I get is 'file' from the output rather than a mime type.

I've tried a few different options from php.net but get functions not found?

I want to use it in an opendir function to read files and their types already on the server, so I can't use $_FILES['type'].

Cheers
 
I've not been able to find anything reliable that gives you the mime type. $_FILES gives you something sent from the browser, based on the file extension, so that's not reliable, and I believe that finfo can be spoofed as well. I normally go with finfo anyway, as it's more reliable than most. It does, however, require an extension.
 
Back
Top Bottom