PHP: mime_content_type() ?

PHP: mime_content_type() ?

Posted by: plaidscreen
Posted on: 2006-02-15 08:56:00

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 - www.paulygon.org
Plaid Screen Studios - www.plaidscreen.com

Re: PHP: mime_content_type() ?

Posted by: scjessey
Posted on: 2006-02-15 10:01:00

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.

Re: PHP: mime_content_type() ?

Posted by: plaidscreen
Posted on: 2006-02-15 11:09:00

Thanks! I will look into that.

Paul Houser - www.paulygon.org
Plaid Screen Studios - www.plaidscreen.com

Re: PHP: mime_content_type() ?

Posted by: plaidscreen
Posted on: 2006-02-15 16:28:00

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

Paul Houser - www.paulygon.org
Plaid Screen Studios - www.plaidscreen.com

Tags: undefined functionfile extensionpaul houserplaid screencgibtwphp5uploadedappreciated