CFile::getMimeTypeByExtension PHP Method

getMimeTypeByExtension() public method

This method will use a local map between extension name and MIME type. This method works only for files.
public getMimeTypeByExtension ( ) : string
return string the MIME type. False is returned if the MIME type cannot be determined.
    public function getMimeTypeByExtension()
    {
        if ($this->getIsFile()) {
            $this->addLog('Trying to get MIME type for "' . $this->_realpath . '" from extension "' . $this->_extension . '"', 'trace');
            static $exts;
            if ($exts === null) {
                $exts = (require $this->getPathOfAlias('system.utils.mimeTypes') . '.php');
            }
            $ext = strtolower($this->_extension);
            if (!empty($ext) && isset($exts[$ext])) {
                return $exts[$ext];
            }
            return False;
        } else {
            $this->addLog('getMimeTypeByExtension() is available only for files', 'warning');
            return False;
        }
    }