Get MIME type from file extension using PHP

This tutorial will show you how we you can get MIME type of a file. Most of the times we need to validate or check MIME type of a file when we upload a file for various reasons like security or validity check. In this tutorial I have defined an array which holds almost all kinds of MIME type of files. So whenever you require to get the MIME type of a particular file then you can easily retrieve the MIME type of that file from this array.