Returns the file type by its name.
The known file types are: image, video, audio, document
@return string Returns the file type or NULL if the item is a folder.
515799
public function getFileType()
    {
        if (!$this->isFile()) {
            return null;
        }

        if (!self::$imageExtensions) {
            self::$imageExtensions = array_map('strtolower', Config::get('cms.storage.media.imageExtensions', FileDefinitions::get('imageExtensions')));
            self::$videoExtensions = array_map('strtolower', Config::get('cms.storage.media.videoExtensions', FileDefinitions::get('videoExtensions')));
            self::$audioExtensions = array_map('strtolower', Config::get('cms.storage.media.audioExtensions', FileDefinitions::get('audioExtensions')));
        }

        $extension = strtolower(pathinfo($this->path, PATHINFO_EXTENSION));
        if (!strlen($extension)) {
            return self::FILE_TYPE_DOCUMENT;
        }

        if (in_array($extension, self::$imageExtensions)) {
            return self::FILE_TYPE_IMAGE;
        }

        if (in_array($extension, self::$videoExtensions)) {
            return self::FILE_TYPE_VIDEO;
        }

        if (in_array($extension, self::$audioExtensions)) {
            return self::FILE_TYPE_AUDIO;
        }

        return self::FILE_TYPE_DOCUMENT;
    }
1261048
public function fileMimeType()
    {
        try {
            $mimeType = $this->storage->mimeType($this->blob->path);
        } catch (\Exception $ex) {
            $ext = pathinfo($this->blob->path, PATHINFO_EXTENSION);
            $mimeType = BlobMetadata::guessMimeType($ext, !!$ext);
        }

        return $mimeType;
    }
496771
protected function getContenType(): string
	{
		return $this->contentType ?? ($this->fileSystem->info($this->filePath)->getMimeType() ?? 'application/octet-stream');
	}
1186078
public function type() {
        return $this->_cache(__FUNCTION__, function($file) {
            /** @type \Transit\File $file */

            $type = null;

            // We can't use the file command on windows
            if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
                $type = shell_exec(sprintf("file -b --mime %s", escapeshellarg($file->path())));

                if ($type && strpos($type, ';') !== false) {
                    $type = strstr($type, ';', true);
                }
            }

            // Fallback because of fileinfo bug: https://bugs.php.net/bug.php?id=53035
            if (!$type) {
                $info = finfo_open(FILEINFO_MIME_TYPE);
                $type = finfo_file($info, $file->path());
                finfo_close($info);
            }

            // Check the mimetype against the extension
            // If they are different, use the extension since fileinfo returns invalid mimetypes
            // This could be problematic in the future, but unknown better alternative
            if ($ext = $file->ext()) {
                try {
                    $extType = MimeType::getTypeFromExt($ext);

                // Use $_FILES['type'] last since sometimes it returns application/octet-stream and other mimetypes
                // When we should always have a true mimetype
                } catch (InvalidArgumentException $e) {
                    $extType = $file->data('type');
                }

                if (!empty($extType) && $type !== $extType) {
                    $type = $extType;
                }
            }

            return $type;
        });
    }
331549
public String getMimeType() {
        if (format >= 0 && format < MIME_TYPE_STRINGS.length) {
            if (format == FORMAT_JPEG && progressive) {
                return "image/pjpeg";
            }
            return MIME_TYPE_STRINGS[format];
        }
        return null;
    }
375790
public function getImageType()
    {
        $this->imageType = ($this->imageType === 'jpg') ? 'jpeg' : $this->imageType;
        $this->imageType = ( in_array($this->imageType, $this->imageTypes) ) ? $this->imageType : 'png';

        return $this->imageType;
    }
484205
public function getMimeType()
    {
        try {
            return $this->mimeType ?: $this->files->mimeType($this->name);
        } catch (ErrorException $e) {
            return;
        }
    }
725849
public function getFilename()
	{
		if ($this->filename == null) {
			$this->requestHead();
		}
		if ($this->filename == null) {
			$filename = pathinfo($this->url)['basename'];
			if (pathinfo($filename, PATHINFO_EXTENSION) === '') {
				$ext = ExtensionGuesser::getInstance()->guess(explode(';', $this->getMimetype())[0]);
				if ($ext && $filename) {
					$filename .= '.' . $ext;
				}
			}
			$this->filename = $filename;
		}
		return $this->filename;
	}
1231072
public static function getFilename()
    {
        if (\is_dir(\dirname(self::$filename))) {
            return self::$filename;
        }

        return (getcwd() ?: './').'/'.self::$filename;
    }
604220
public function mimeType() {
        // if the type is known, return it
        if (!is_null($this->type)) {
            return $this->type;
        }
        
        // make sure the file is available to check
        $this->downloadFile();
        
        // get the file info
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        
        // get the MIME type of the file 
        $mime= finfo_file($finfo, $this->downloadFilePath());
        
        // clode the file info resource
        finfo_close($finfo);
        
        // store and return the file MIME type
        return $this->type = $mime;
    }
379913
public function getFileType(): ?array
    {
        if (empty($this->byteCache)) {
            return null;
        }

        /** cache */
        if (is_null($this->fileType)) {
            $this->fileType = $this->checkFileType();
        }

        return $this->fileType;
    }
46838
public function getTypeObject()
    {
        $app = Application::getFacadeApplication();
        $fh = $app->make('helper/file');
        $ext = $fh->getExtension($this->fvFilename);
        $ftl = FileTypeList::getType($ext);

        return $ftl;
    }
663281
public function getFilename() : ?string 
    {
        if ( ! $this->hasFilename()) {
            $this->setFilename($this->getDefaultFilename());
        }
        return $this->filename;
    }
1259335
public String getFileType() {
        if (fileTypeOrName != null && fileTypeOrName.contains(".")) {
            return FileUtils.getExtension(fileTypeOrName);
        } else {
            return fileTypeOrName;
        }
    }
36397
public function dataType()
    {
        $fileInfo = new finfo( FILEINFO_MIME_TYPE | FILEINFO_SYMLINK );
        $mimeType = $fileInfo->file( $this->filePath );
        eZDebugSetting::writeDebug( 'kernel-clustering', $mimeType, "fs::dataType( {$this->filePath} )" );
        return $mimeType ?: null;
    }
1050555
public function getMimeType()
    {
        if ($this->isUploaded() && $this->mime_type === null) {
            $temp_file_name = $this->getTempFileName();
            if (file_exists($temp_file_name)) {
                if (extension_loaded('fileinfo')) {
                    // Use the fileinfo extension if available.
                    $finfo = $this->getFinfo();
                    $this->mime_type = explode(
                        ';',
                        $finfo->file($temp_file_name)
                    )[0];
                } elseif (function_exists('mime_content_type')) {
                    // Fall back to mime_content_type() if available.
                    $this->mime_type = mime_content_type($temp_file_name);
                }

                // No mime-detection functions, or mime-detection function
                // failed to detect the type. Default to
                // 'application/octet-stream'. Relying on HTTP headers could
                // be a security problem so we never fall back to that option.
                if ($this->mime_type == '') {
                    $this->mime_type = 'application/octet-stream';
                }
            } else {
                $this->mime_type = $this->file['type'];
            }
        }

        return $this->mime_type;
    }
1215804
public function getMimeType()
    {
        if ($this->exists()) {
            $finfo = new \finfo(FILEINFO_MIME_TYPE | FILEINFO_PRESERVE_ATIME);
            $mime = $finfo->file($this->getRealPath());
            return $mime;
        }
        return null;
    }