file_create_path

  1. drupal
    1. 4.7 file.inc
    2. 5 file.inc
    3. 6
Versions
4.7 – 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.

Parameters

$dest A string containing the path to verify. If this value is omitted, Drupal's 'files' directory will be used.

Return value

A string containing the path to file, with file system directory appended if necessary, or FALSE if the path is invalid (i.e. outside the configured 'files' or temp directories).

Related topics

▾ 15 functions call file_create_path()

drupal_build_css_cache in drupal/includes/common.inc
Aggregate and optimize CSS files, putting them in the files directory.
drupal_build_js_cache in drupal/includes/common.inc
Aggregate JS files, putting them in the files directory.
drupal_clear_css_cache in drupal/includes/common.inc
Delete all cached CSS files.
drupal_clear_js_cache in drupal/includes/common.inc
Delete all cached JS files.
file_copy in drupal/includes/file.inc
Copies a file to a new location.
file_download in drupal/includes/file.inc
Call modules that implement hook_file_download() to find out if a file is accessible and what headers it should be transferred with. If a module returns -1 drupal_access_denied() will be returned. If one or more modules returned headers the download…
file_save_upload in drupal/includes/file.inc
Saves a file upload to a new location.
file_transfer in drupal/includes/file.inc
Transfer file using http to client. Pipes a file through Drupal to the client.
hook_file_download in developer/hooks/core.php
Control access to private file downloads and specify HTTP headers.
locale_uninstall in drupal/modules/locale/locale.install
Implementation of hook_uninstall().
locale_update_js_files in drupal/modules/locale/locale.module
Update JavaScript translation file, if required, and add it to the page.
upload_file_download in drupal/modules/upload/upload.module
Implementation of hook_file_download().
user_admin_settings in drupal/modules/user/user.admin.inc
Form builder; Configure user settings for this site.
user_file_download in drupal/modules/user/user.module
Implementation of hook_file_download().
_locale_rebuild_js in drupal/includes/locale.inc
(Re-)Creates the JavaScript translation file for a language.

Code

drupal/includes/file.inc, line 64

<?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;
}
?>