Same name and namespace in other branches
  1. 4.7.x includes/file.inc \file_directory_temp()
  2. 5.x includes/file.inc \file_directory_temp()
  3. 6.x includes/file.inc \file_directory_temp()
  4. 7.x includes/file.inc \file_directory_temp()

Gets and sets the path of the configured temporary directory.

Return value

mixed|null A string containing the path to the temporary directory.

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\File\FileSystemInterface::getTempDirectory() instead.

See also

\Drupal\Core\File\FileSystemInterface::getTempDirectory()

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

Related topics

1 call to file_directory_temp()
FileSystemDeprecationTest::testDeprecatedUnmanagedFileMove in core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php
@expectedDeprecation file_directory_temp() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\File\FileSystemInterface::getTempDirectory() instead. See https://www.drupal.org/node/3039255 @expectedDeprecation…
2 string references to 'file_directory_temp'
File::initializeIterator in core/modules/file/src/Plugin/migrate/source/d6/File.php
Initializes the iterator with the source data.
UserPictureFile::initializeIterator in core/modules/user/src/Plugin/migrate/source/d6/UserPictureFile.php
Initializes the iterator with the source data.

File

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

Code

function file_directory_temp() {
  @trigger_error('file_directory_temp() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \\Drupal\\Core\\File\\FileSystemInterface::getTempDirectory() instead. See https://www.drupal.org/node/3039255', E_USER_DEPRECATED);
  return \Drupal::service('file_system')
    ->getTempDirectory();
}