Version: v0.7.0 - Beta.  We welcome contributors & feedback.


File.getMimeType($path) -> string


Get the MIME type of the file.

The $path is relative to the data/files directory.

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.

//= 'image/png'

//= 'application/pdf'

See Also