file_directory_os_temp

function file_directory_os_temp

file_directory_os_temp()

Discovers a writable system-appropriate temporary directory.

Return value

mixed A string containing the path to the temporary directory.

Related topics

File interface
Common file handling functions.

File

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

Code

function file_directory_os_temp() {
  $directories = array();

  // Has PHP been set with an upload_tmp_dir?
  if (ini_get('upload_tmp_dir')) {
    $directories[] = ini_get('upload_tmp_dir');
  }

  // Operating system specific dirs.
  if (substr(PHP_OS, 0, 3) == 'WIN'