File::setFilename

public File::setFilename($filename)

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 50

Class

File
Defines the file entity class.

Namespace

Drupal\file\Entity

Code

1
2
3
public function setFilename($filename) {
  $this->get('filename')->value = $filename;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.