Get the MIME type of the file.
$path is relative to the
This function uses PHP's FileInfo, which looks at key patterns in the file content. This is incrementally more secure than reading the file extension, which could be wrong or changed by an attacker to evade filtering.
For user-uploaded image files, use
Input.uploadedImage() to get a safely resized version of the file.
If you are serving other user-uploaded file types, a virus scanner is highly recommended.
File.getMimeType('profileImage.png') //= 'image/png' File.getMimeType('taxForm.pdf') //= 'application/pdf'