'How do i get only the first part of the MIME type in PHP

I would only like to know if a file is an image, a video or another type of file. The file does not exist on the server, as it is being uploaded.

Is there a way to get this in PHP?

Thank you



Solution 1:[1]

$mime = explode('/', mime_content_type($physicalPathForTheFile));
$type = $mime[0];

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Usama