What potential issues can arise when determining the MIME type of a file in PHP?
One potential issue when determining the MIME type of a file in PHP is that the file extension may not always accurately reflect the actual content type. To solve this, you can use the `finfo_file()` function in PHP, which uses file magic to determine the MIME type based on the file contents rather than the extension.
$file_path = 'example.txt';
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime_type = finfo_file($finfo, $file_path);
finfo_close($finfo);
echo "MIME type of $file_path is: $mime_type";