You are here

public function File::setFilename in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/src/Entity/File.php \Drupal\file\Entity\File::setFilename()
  2. 9 core/modules/file/src/Entity/File.php \Drupal\file\Entity\File::setFilename()

Sets the name of the file.

Parameters

string $filename: The file name that corresponds to this file. May differ from the basename of the URI and changing the filename does not change the URI.

Overrides FileInterface::setFilename

File

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

Class

File
Defines the file entity class.

Namespace

Drupal\file\Entity

Code

public function setFilename($filename) {
  $this
    ->get('filename')->value = $filename;
}