FileinfoMimeTypeGuesser

class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface

Guesses the mime type using the PECL extension FileInfo.

Methods

__construct(string $magicFile = null)

Constructor.

static bool isSupported()

Returns whether this guesser is supported on the current OS/PHP setup.

string guess(string $path)

Guesses the mime type of the file with the given path.

Details

__construct(string $magicFile = null)

Constructor.

Parameters

string $magicFile A magic file to use with the finfo instance

static bool isSupported()

Returns whether this guesser is supported on the current OS/PHP setup.

Return Value

bool

string guess(string $path)

Guesses the mime type of the file with the given path.

Parameters

string $path The path to the file

Return Value

string The mime type or NULL, if none could be guessed

Exceptions

FileNotFoundException If the file does not exist
AccessDeniedException If the file could not be read
doc_Symfony
2016-10-28 06:16:29
Comments
Leave a Comment

Please login to continue.