PHP | mime_content_type() function Last Updated : 15 Jul, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The mime_content_type() function is an inbuilt function in PHP which is used to get the MIME content-type of a file. Syntax: string mime_content_type( $file ) Parameters: This function accepts single parameter $file which specifies the path of the file which MIME details to be find. Return Value: This function returns the MIME content type or False on failure. Below programs illustrate the mime_content_type() function in PHP: Program 1: Original Image: php <?php // PHP program to illustrate mime_content_type function echo mime_content_type('gfg.png') . "</br>"; ?> Output: image/png Program 2: Original Image: php <?php // PHP program to illustrate // mime_content_type function // Providing and print result of different kind of files echo mime_content_type('/home/rajvir/Desktop/gfg.png') . "</br>"; echo mime_content_type('/home/rajvir/Desktop/gfg_Article.html') . "</br>"; echo mime_content_type('/home/rajvir/Downloads/gfg.gif') . "</br>"; echo mime_content_type('/home/rajvir/Desktop/gfg_contribute.txt') . "</br>"; echo mime_content_type('/home/rajvir/Downloads/geeks.ppt') . "</br>"; echo mime_content_type('/home/rajvir/Downloads/geeks.pdf') . "</br>"; ?> Output: image/png text/plain image/gif text/plain application/vnd.ms-powerpoint application/pdf Reference: http://php.net/manual/en/function.mime-content-type.php Comment More infoAdvertise with us Next Article PHP | mime_content_type() function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP image_type_to_extension() Function The image_type_to_extension() function is an inbuilt function in PHP which is used to get the file extension for an image type. This function can be found in any PHP version similar or greater than 5.2.0. Syntax: string image_type_to_extension( int $imagetype, bool $include_dot ) Parameters: This fu 1 min read PHP file_get_contents() Function In this article, we will see how to read the entire file into a string using the file_get_contents() function, along with understanding their implementation through the example.The file_get_contents() function in PHP is an inbuilt function that is used to read a file into a string. The function uses 3 min read PHP | file_put_contents() Function The file_put_contents() function in PHP is an inbuilt function which is used to write a string to a file. The file_put_contents() function checks for the file in which the user wants to write and if the file doesn't exist, it creates a new file. The path of the file on which the user wants to write 2 min read PHP | settype() Function The settype() function is a built-in function in PHP. The settype() function is used to the set the type of a variable. It is used to set type or modify type of an existing variable. Syntax: boolean settype($variable_name, $type) Parameters: The settype() function accepts two parameters as shown in 2 min read PHP | image_type_to_mime_type() Function The image_type_to_mime_type() function is an inbuilt function in PHP which is used to get the MimeType for an imagetype returned by other different functions like getimagesize(), exif_read_data(), exif_thumbnail(), exif_imagetype() etc. The MIME stands for Multi-purpose Internet Mail Extensions. MIM 2 min read Like