Make use of the finfo()
functions.
A simple illustration:
<?php
$finfo = finfo_open(FILEINFO_MIME_TYPE);
echo finfo_file($finfo, "path/to/image_dir/image.gif");
finfo_close($finfo);
OUTPUT :
image/gif
Note : Windows users must include the bundled php_fileinfo.dll
DLL file in php.ini to enable this extension.
Related Contents:
- What are the Google Apps MIME Types in Google Docs and Google Drive?
- Why is mime_content_type() deprecated in PHP?
- List of ALL MimeTypes on the Planet, mapped to File Extensions? [closed]
- What is the correct JSON content type?
- Why is the tag deprecated in HTML?
- How to check file MIME type with javascript before upload?
- Replacements for deprecated JPMS modules with Java EE APIs
- Stylesheet not loaded because of MIME-type
- jQuery 1.9 .live() is not a function
- Chrome says “Resource interpreted as script but transferred with MIME type text/plain.”, what gives?
- Deprecated: mysql_connect() [duplicate]
- Replacement for deprecated sizeWithFont: in iOS 7?
- What is correct content-type for excel files? [duplicate]
- Why is StringTokenizer deprecated?
- Is it wrong to use Deprecated methods or classes in Java?
- Return a PHP page as an image
- How to ignore deprecation warnings in Python
- Is the buildSessionFactory() Configuration method deprecated in Hibernate?
- handle json request in PHP
- What is a MIME type?
- Proper MIME type for .woff2 fonts
- How to check file types of uploaded files in PHP?
- CodeIgniter: “The filetype you are attempting to upload is not allowed.”
- How to successfully rewrite old mysql-php code with deprecated mysql_* functions?
- Preparation for std::iterator Being Deprecated
- OnGlobalLayoutListener: deprecation and compatibility
- getch is deprecated
- getResources().getColor() is deprecated [duplicate]
- Observer is deprecated in Java 9. What should we use instead of it?
- Why was ActionBarActivity deprecated
- Deprecated conversion from string literal to ‘char*’
- How to use spl_autoload() instead of __autoload()
- Stop caching for PHP 5.5.3 in MAMP
- Is the MIME type ‘image/jpg’ the same as ‘image/jpeg’?
- .rar, .zip files MIME Type
- Why am I getting mime-type of .csv file as “application/octet-stream”?
- Why is the Date constructor deprecated, and what do I use instead?
- PHP Error : Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` [duplicate]
- JSON Specification and usage of BOM/charset-encoding
- Deprecation status of the NumPy matrix class
- CSS not loading wrong MIME type Django [duplicate]
- “not well-formed” error in Firefox when loading JSON file with XMLHttpRequest
- Uploading a csv into Codeigniter
- Python not equal operator
- Unknown file type MIME?
- Replacement for stringByAddingPercentEscapesUsingEncoding in ios9?
- Debug message “Resource interpreted as other but transferred with MIME type application/javascript”
- Replacement for “purpose” property of CLLocationManager
- KeyboardEvent.keyCode deprecated. What does this mean in practice?
- BaseException.message deprecated in Python 2.6