finfo_file

Supported Versions: PHP >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0
Return information about a file
<?php finfo_file(    finfo $finfo,    string $filename,    int $flags = FILEINFO_NONE,    ?resource $context = null): string|false
<?php     public function mimeType($path)

    {

        return finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);

    }
<?php         $this->filename = array_key_exists('filename', $info) ? $info['filename'] : null;



        if (file_exists($path) && is_file($path)) {

            $this->mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);

        }



        return $this;
<?php         }




        $mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);




        switch (strtolower($mime)) {