function file_create_filename
Same name in other branches
- 7.x includes/file.inc \file_create_filename()
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
$basename: String filename
$directory: String containing the directory or parent URI.
Return value
File path consisting of $directory and a unique filename based off of $basename.
Deprecated
in drupal:8.7.0 and is removed from drupal:9.0.0. Use \Drupal\Core\File\FileSystemInterface::createFilename().
See also
https://www.drupal.org/node/3006851
Related topics
1 call to file_create_filename()
- FileSystemDeprecationTest::testDeprecatedFileCreate in core/
tests/ Drupal/ KernelTests/ Core/ File/ FileSystemDeprecationTest.php - @expectedDeprecation file_create_filename() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystemInterface::createFilename(). See https://www.drupal.org/node/3006851.
File
-
core/
includes/ file.inc, line 755
Code
function file_create_filename($basename, $directory) {
@trigger_error('file_create_filename() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\Core\\File\\FileSystemInterface::createFilename(). See https://www.drupal.org/node/3006851.', E_USER_DEPRECATED);
return \Drupal::service('file_system')->createFilename($basename, $directory);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.