src/UploadedFile.php
public function getMediaType()
    {
        if ($this->hasMoved()) {
            throw new \RuntimeException(sprintf('Uploaded file "%s" has already moved', $this->file));
        }

        if (extension_loaded('fileinfo')) {
            $finfo = finfo_open(FILEINFO_MIME);
            $mime = finfo_file($finfo, $this->file);
            finfo_close($finfo);

            $mime = explode(";", $mime);
            $mime = trim($mime[0]);

            return $mime;
        } else {
            throw new \RuntimeException(sprintf('You must install fileinfo extension to determine the real type of uploaded file "%s"', $this->file));
        }
    }
public function getMediaType()
    {
        if ($this->hasMoved()) {
            throw new \RuntimeException(sprintf('Uploaded file "%s" has already moved', $this->file));
        }

        if (extension_loaded('fileinfo')) {
            $finfo = finfo_open(FILEINFO_MIME);
            $mime = finfo_file($finfo, $this->file);
            finfo_close($finfo);

            $mime = explode(";", $mime);
            $mime = trim($mime[0]);

            return $mime;
        } else {
            throw new \RuntimeException(sprintf('You must install fileinfo extension to determine the real type of uploaded file "%s"', $this->file));
        }
    }
Retrieve the media type of file.

@return string|null The media type or null if unavailable
@throws \RuntimeException on any error during the mime extraction operation.