function FileSystemInterface::getDestinationFilename
Same name in other branches
- 8.9.x core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::getDestinationFilename()
- 10 core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::getDestinationFilename()
- 11.x core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::getDestinationFilename()
Determines the destination path for a file.
Parameters
string $destination: The desired final URI or filepath.
int $replace: Replace behavior when the destination file already exists.
- FileSystemInterface::EXISTS_REPLACE - Replace the existing file.
- FileSystemInterface::EXISTS_RENAME - Append _{incrementing number} until the filename is unique.
- FileSystemInterface::EXISTS_ERROR - Do nothing and return FALSE.
Return value
string|bool The destination filepath, or FALSE if the file already exists and FileSystemInterface::EXISTS_ERROR is specified.
Throws
\Drupal\Core\File\Exception\FileException Implementation may throw FileException or its subtype on failure.
1 method overrides FileSystemInterface::getDestinationFilename()
- FileSystem::getDestinationFilename in core/
lib/ Drupal/ Core/ File/ FileSystem.php - Determines the destination path for a file.
File
-
core/
lib/ Drupal/ Core/ File/ FileSystemInterface.php, line 448
Class
- FileSystemInterface
- Provides an interface for helpers that operate on files and stream wrappers.
Namespace
Drupal\Core\FileCode
public function getDestinationFilename($destination, $replace);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.