public function File::guessExtension

Returns the extension based on the mime type.

If the mime type is unknown, returns null.

@api

Return value

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

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/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);
}