Nextcloud PHP API (stable19)

IMimeTypeDetector

Interface IMimeTypeDetector

Tags
since
8.2.0

Interface to handle mimetypes (detection and icon retrieval)

Table of Contents

detect()  : string
detect mimetype based on both filename and content
detectContent()  : string
detect mimetype only based on the content of file
detectPath()  : string
detect mimetype only based on filename, content of file is not used
detectString()  : string
detect mimetype based on the content of a string
getSecureMimeType()  : string
Get a secure mimetype that won't expose potential XSS.
mimeTypeIcon()  : string
Get path to the icon of a file type

Methods

detect()

detect mimetype based on both filename and content

public detect(string $path) : string
Parameters
$path : string
Tags
since
8.2.0
Return values
string

detectContent()

detect mimetype only based on the content of file

public detectContent(string $path) : string
Parameters
$path : string
Tags
since
18.0.0
Return values
string

detectPath()

detect mimetype only based on filename, content of file is not used

public detectPath(string $path) : string
Parameters
$path : string
Tags
since
8.2.0
Return values
string

detectString()

detect mimetype based on the content of a string

public detectString(string $data) : string
Parameters
$data : string
Tags
since
8.2.0
Return values
string

getSecureMimeType()

Get a secure mimetype that won't expose potential XSS.

public getSecureMimeType(string $mimeType) : string
Parameters
$mimeType : string
Tags
since
8.2.0
Return values
string

mimeTypeIcon()

Get path to the icon of a file type

public mimeTypeIcon(string $mimeType) : string
Parameters
$mimeType : string

the MIME type

Tags
since
8.2.0
Return values
string

the url

Search results