You are here

public function File::guessExtension in Zircon Profile 8

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

Returns the extension based on the mime type.

If the mime type is unknown, returns null.

This method uses the mime type as guessed by getMimeType() to guess the file extension.

Return value

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

See also

ExtensionGuesser

getMimeType()

File

vendor/symfony/http-foundation/File/File.php, line 56

Class

File
A file in the file system.

Namespace

Symfony\Component\HttpFoundation\File

Code

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