You are here

public function UploadedFile::guessClientExtension in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/File/UploadedFile.php \Symfony\Component\HttpFoundation\File\UploadedFile::guessClientExtension()

Returns the extension based on the client mime type.

If the mime type is unknown, returns null.

This method uses the mime type as guessed by getClientMimeType() to guess the file extension. As such, the extension returned by this method cannot be trusted.

For a trusted extension, use guessExtension() instead (which guesses the extension based on the guessed mime type for the file).

Return value

string|null The guessed extension or null if it cannot be guessed

See also

guessExtension()

getClientMimeType()

File

vendor/symfony/http-foundation/File/UploadedFile.php, line 160

Class

UploadedFile
A file uploaded through a form.

Namespace

Symfony\Component\HttpFoundation\File

Code

public function guessClientExtension() {
  $type = $this
    ->getClientMimeType();
  $guesser = ExtensionGuesser::getInstance();
  return $guesser
    ->guess($type);
}