You are here

public function FileSystemInterface::createFilename in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::createFilename()
  2. 9 core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::createFilename()

Creates a full file path from a directory and filename.

If a file with the specified name already exists, an alternative will be used.

Parameters

string $basename: The filename.

string $directory: The directory or parent URI.

Return value

string File path consisting of $directory and a unique filename based off of $basename.

Throws

\Drupal\Core\File\Exception\FileException Implementation may throw FileException or its subtype on failure.

File

core/lib/Drupal/Core/File/FileSystemInterface.php, line 428

Class

FileSystemInterface
Provides an interface for helpers that operate on files and stream wrappers.

Namespace

Drupal\Core\File

Code

public function createFilename($basename, $directory);