function FileSystemInterface::createFilename

Same name in other branches
  1. 9 core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::createFilename()
  2. 8.9.x core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::createFilename()
  3. 11.x 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 434

Class

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

Namespace

Drupal\Core\File

Code

public function createFilename($basename, $directory);

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