As discussed in Modifying Image Uploads With PHP Programming and PHP Programming And MIME-Types the MIME-Type of a file is often a valuable piece of information. Simply knowing the difference between a JPEGand GIF file type changes the way a PHP Programmer codes an image handler script. The difference between “text/plain” and “application/octet-stream” is significant. The files handed to the PHP Program, or uploaded from a PHP File Upload Web Page, may be deceptive by file name alone, or may lack a file name extensions altogether.
mb_preferred_mime_name() performs the same result set as the mime_content_type() command above. When handling images, using image_type_to_mime_type() is another valuable option. Which command or set of commands the PHP Programmer selects is based on experience, preference, and the conditions of the script being programmed. Environments such as working with email may require using the iconv_mime_decode() command instead of the image_type_to_mime_type() or hw_api_content() commands.