file_directory_temp

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/file.inc, строка 671

Версии
5 – 6
file_directory_temp()

Определеляет папку по умолчанию для хранения временных файлов.

Возвращаемое значение

Строка, содержащая путь к папке по умолчанию для хранения временных файлов.

Связанные темы

▾ 7 функции вызывают file_directory_temp()

file_check_directory in includes/file.inc
Проверка каталога на существование и доступность для записи.
file_check_upload in includes/file.inc
Verify an uploaded file.
file_create_path in includes/file.inc
Make sure the destination is a complete path and resides in the file system directory, if it is not prepend the file system directory.
file_save_data in includes/file.inc
Save a string to the specified destination.
file_save_upload in includes/file.inc
Saves a file upload to a new location. The source file is validated as a proper upload and handled as such.
system_file_system_settings in modules/system/system.module
upload_form_alter in modules/upload/upload.module

Код

<?php
function file_directory_temp() {
  $temporary_directory = variable_get('file_directory_temp', NULL);

  if (is_null($temporary_directory)) {
    $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') {
      $directories[] = 'c:\\windows\\temp';
      $directories[] = 'c:\\winnt\\temp';
      $path_delimiter = '\\';
    }
    else {
      $directories[] = '/tmp';
      $path_delimiter = '/';
    }

    foreach ($directories as $directory) {
      if (!$temporary_directory && is_dir($directory)) {
        $temporary_directory = $directory;
      }
    }

    // if a directory has been found, use it, otherwise default to 'files/tmp' or 'files\\tmp';
    $temporary_directory = $temporary_directory ? $temporary_directory : file_directory_path() . $path_delimiter . 'tmp';
    variable_set('file_directory_temp', $temporary_directory);
  }

  return $temporary_directory;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему