8.5.x file.inc drupal_tempnam($directory, $prefix)
8.0.x file.inc drupal_tempnam($directory, $prefix)
8.1.x file.inc drupal_tempnam($directory, $prefix)
8.2.x file.inc drupal_tempnam($directory, $prefix)
8.3.x file.inc drupal_tempnam($directory, $prefix)
8.4.x file.inc drupal_tempnam($directory, $prefix)
8.6.x file.inc drupal_tempnam($directory, $prefix)
7.x file.inc drupal_tempnam($directory, $prefix)

Creates a file with a unique filename in the specified directory.

Deprecated

in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystem::tempnam().

See also

https://www.drupal.org/node/2418133

Related topics

4 calls to drupal_tempnam()
file_unmanaged_save_data in core/includes/file.inc
Saves a file to the specified destination without invoking file API.
GDToolkit::save in core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
Writes an image resource to a destination file.
ImageItem::generateSampleValue in core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
Generates placeholder field values.
update_manager_local_transfers_allowed in core/modules/update/update.manager.inc
Determines if file transfers will be performed locally.

File

core/includes/file.inc, line 1209
API for handling file uploads and server file management.

Code

function drupal_tempnam($directory, $prefix) {
  return \Drupal::service('file_system')
    ->tempnam($directory, $prefix);
}