file_create_path
includes/file.inc, строка 51
- Версии
- 5 – 6
file_create_path($dest = 0)
Make sure the destination is a complete path and resides in the file system directory, if it is not prepend the file system directory.
Параметры
$dest
Строка, содержащая путь для проверки. Если это значение опущено, то путь к папке 'files'
Друпал будет использован.
Возвращаемое значение
Строка, содержащая путь к файлу, с добавлением системной папки для файлов, если нужно. FALSE
- если путь не верный (то есть находится вне настроенных папок 'files'
или temp).
Связанные темы
Код
<?php
function file_create_path($dest = 0) {
$file_path = file_directory_path();
if (!$dest) {
return $file_path;
}
// file_check_location() checks whether the destination is inside the Drupal files directory.
if (file_check_location($dest, $file_path)) {
return $dest;
}
// check if the destination is instead inside the Drupal temporary files directory.
else if (file_check_location($dest, file_directory_temp())) {
return $dest;
}
// Not found, try again with prefixed directory path.
else if (file_check_location($file_path . '/' . $dest, $file_path)) {
return $file_path . '/' . $dest;
}
// File not found.
return FALSE;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии