File::type()

Gets the file MIME type.

Table of Contents
  1. Description
  2. Example

Description

File::type(): ?string;

This method returns the MIME type of the file if the file exists. It returns null if the file does not exist or when it fails to detect the file’s MIME type.

Example

$file = new File('.\path\to\file.txt');

$type = $file->type(); // Returns `'text/plain'`

File::size()

Gets the file sizes in human readable string format.

File::type()

Gets the file MIME type.