PHP: mime_content_type()?

software development


I’m trying to use mime_content_type() but I get a fatal error,
Call to undefined function: mime_content_type()

My server is running PHP5 as a CGI, and I tried it w/o CGI and it still didn’t work. So how can I enable this function? I would like to be able to read the file type of files uploaded through a form (ie $_FILES[“file”][“tmp_name”]) , and they have random names like 3vna37 with no file extension. (BTW, I would rather not just check the file type against the [“name”] field, as people can fake a file extension and mess things up. So any help is appreciated. Thanks!

Paul Houser -
Plaid Screen Studios -


The function requires the (deprecated) Mime Magic extension to be activated. There may be an alternative you can use, but I don’t know anything about it.

Simon Jessey
Keystone Websites | si-blog


Thanks! I will look into that.

Paul Houser -
Plaid Screen Studios -


Hmm… this fileinfo alternative requires compiling a library into the php installation, which is out of my abilities. Thanks though.

Paul Houser -
Plaid Screen Studios -