What is the function mime_content_type() used for in PHP?
The function mime_content_type() is used in PHP to determine the MIME type of a file. This can be useful when working with file uploads or when needing to verify the type of a file before processing it further in your code.
$file = 'example.txt';
$mime_type = mime_content_type($file);
echo "The MIME type of $file is: $mime_type";
Keywords
Related Questions
- What best practices should be followed when handling form data in PHP, particularly in login and registration systems?
- What are some best practices for implementing a file manager in PHP for user uploads?
- What is the role of error_reporting(E_ALL) in PHP and how does it affect syntax errors in include files?