/**
* Attempts to determine the file extension based on the trusted
* getType() method. If the mime type is unknown, will return null.
*/
public function guessExtension(): ?string
{ // naively get the path extension using pathinfo
$pathinfo =
pathinfo($this->
getRealPath() ?:
$this->
__toString()) +
['extension' => ''
];
$proposedExtension =
$pathinfo['extension'
];
return Mimes::
guessExtensionFromType($this->
getMimeType(),
$proposedExtension);
} /**
* Retrieve the media type of the file. SHOULD not use information from
* the $_FILES array, but should use other methods to more accurately
* determine the type of file, like finfo, or mime_content_type().
*
* @return string The media type we determined it to be.
*/
public function getMimeType(): string
{