FileInfo
class FileInfo extends SplFileInfo
File info.
Methods
string|null
getMimeType()
Returns the MIME type of the file.
string|null
getMimeEncoding()
Returns the MIME encoding of the file.
string
getHash(string $algorithm = 'sha256', bool $raw = false)
Generates a hash using the contents of the file.
bool
validateHash(string $hash, string $algorithm = 'sha256', bool $raw = false)
Returns true if the file matches the provided hash and false if not.
string
getHmac(string $key, string $algorithm = 'sha256', bool $raw = false)
Generates a HMAC using the contents of the file.
bool
validateHmac(string $hmac, string $key, string $algorithm = 'sha256', bool $raw = false)
Returns true if the file matches the provided HMAC and false if not.
Details
at line 31
string|null
getMimeType()
Returns the MIME type of the file.
at line 47
string|null
getMimeEncoding()
Returns the MIME encoding of the file.
at line 65
string
getHash(string $algorithm = 'sha256', bool $raw = false)
Generates a hash using the contents of the file.
at line 78
bool
validateHash(string $hash, string $algorithm = 'sha256', bool $raw = false)
Returns true if the file matches the provided hash and false if not.
at line 91
string
getHmac(string $key, string $algorithm = 'sha256', bool $raw = false)
Generates a HMAC using the contents of the file.
at line 105
bool
validateHmac(string $hmac, string $key, string $algorithm = 'sha256', bool $raw = false)
Returns true if the file matches the provided HMAC and false if not.