Alex Rivera | Logout

PHP: File extension to MIME type?

Asked 2012-07-18T15:13:15.577
10

Possible Duplicate:
How do I determine the extension(s) associated with a MIME type in PHP?

I'm aware of how to get the MIME type of a given file, but is there a way to do it given only an extension?

Example input:

jpg

Example output:

image/jpeg
Edit
Report

1 Answer

2

The most elegant solution I've seen for Apache environments is http://www.php.net/manual/en/function.mime-content-type.php#107798

answered 2012-07-18T15:22:00.857

Your Answer