FileType
in package
File type
Table of Contents
Properties
- $filesType : array<string|int, mixed>
- File type items
Methods
- getFileType() : string|false
- Get file type
- getFileTypeItem() : array<string|int, mixed>|false
- Get file type item info
- isApplication() : bool
- Return true if file is application
- isAudio() : bool
- Return true if file is audio
- isDirectory() : bool
- Return true if file type is directory
- isFileType() : bool
- Return true if file have mime type
- isFont() : bool
- Return true if file is font
- isImage() : bool
- Return true if file is image
- isPdf() : bool
- Return true if file is pdf
- isText() : bool
- Return true if file is text
- isVideo() : bool
- Return true if file is video
- isZip() : bool
- Return true if file type is zip
Properties
$filesType
File type items
private
static array<string|int, mixed>
$filesType
= ['image' => ['start' => 0, 'length' => 5], 'video' => ['start' => 0, 'length' => 5], 'audio' => ['start' => 0, 'length' => 5], 'pdf' => ['start' => -3, 'length' => 3], 'text' => ['start' => 0, 'length' => 4], 'font' => ['start' => 0, 'length' => 4], 'zip' => ['items' => ['application/zip', 'application/x-zip-compressed', 'multipart/x-zip']], 'application' => ['start' => 0, 'length' => 11]]
Methods
getFileType()
Get file type
public
static getFileType(string $mimeType) : string|false
Parameters
- $mimeType : string
Return values
string|falsegetFileTypeItem()
Get file type item info
public
static getFileTypeItem(string $type) : array<string|int, mixed>|false
Parameters
- $type : string
Return values
array<string|int, mixed>|falseisApplication()
Return true if file is application
public
static isApplication(string $mimeType) : bool
Parameters
- $mimeType : string
Return values
boolisAudio()
Return true if file is audio
public
static isAudio(string $mimeType) : bool
Parameters
- $mimeType : string
Return values
boolisDirectory()
Return true if file type is directory
public
static isDirectory(string $mimeType) : bool
Parameters
- $mimeType : string
Return values
boolisFileType()
Return true if file have mime type
public
static isFileType(string $type, string $mimeType) : bool
Parameters
- $type : string
-
one from: image,video,audio,application,text,pdd,font
- $mimeType : string
Return values
boolisFont()
Return true if file is font
public
static isFont(string $mimeType) : bool
Parameters
- $mimeType : string
Return values
boolisImage()
Return true if file is image
public
static isImage(string $mimeType) : bool
Parameters
- $mimeType : string
Return values
boolisPdf()
Return true if file is pdf
public
static isPdf(string $mimeType) : bool
Parameters
- $mimeType : string
Return values
boolisText()
Return true if file is text
public
static isText(string $mimeType) : bool
Parameters
- $mimeType : string
Return values
boolisVideo()
Return true if file is video
public
static isVideo(string $mimeType) : bool
Parameters
- $mimeType : string
Return values
boolisZip()
Return true if file type is zip
public
static isZip(string $mimeType) : bool
Parameters
- $mimeType : string