Determining a Local File's Mime Type (Content-type) With PHP
- by Sonny
I am trying to determine a file's mime type. I've tried a few methods, but haven't come up with anything that gives consistent output. I've tried $mime = mime_content_type($file) and $mime = exec('file -bi ' . $file). I am serving up images, CSS, JavaScript, and images.