function File::getMimeType

Same name and namespace in other branches
  1. 10 core/modules/file/src/Entity/File.php \Drupal\file\Entity\File::getMimeType()
  2. 9 core/modules/file/src/Entity/File.php \Drupal\file\Entity\File::getMimeType()
  3. 8.9.x core/modules/file/src/Entity/File.php \Drupal\file\Entity\File::getMimeType()

Returns the MIME type of the file.

Return value

string|null The MIME type of the file, e.g. image/jpeg or text/xml, or NULL if it could not be determined.

Overrides FileInterface::getMimeType

1 call to File::getMimeType()
File::getDownloadHeaders in core/modules/file/src/Entity/File.php
Examines a file entity and returns content headers for download.

File

core/modules/file/src/Entity/File.php, line 108

Class

File
Defines the file entity class.

Namespace

Drupal\file\Entity

Code

public function getMimeType() {
  return $this->get('filemime')->value;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.