file_create_path

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 file_create_path($dest = 0)
drupal7 file_create_path($destination = NULL)

Make sure the destination is a complete path and resides in the file system directory, if it is not prepend the file system directory.

Übergabeparameter

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

Rückgabewert

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).

Verwandte Themen

▾ 20 functions call file_create_path()

drupal_build_css_cache in includes/common.inc
Aggregate and optimize CSS files, putting them in the files directory.
drupal_build_js_cache in includes/common.inc
Aggregate JS files, putting them in the files directory.
drupal_clear_css_cache in includes/common.inc
Delete all cached CSS files.
drupal_clear_js_cache in includes/common.inc
Delete all cached JS files.
file_copy in includes/file.inc
Copy a file to a new location and adds a file record to the database.
file_download in includes/file.inc
Menu handler for private file transfers.
file_move in includes/file.inc
Move a file to a new location and update the file's database entry.
file_save_data in includes/file.inc
Save a string to the specified destination and create a database file entry.
file_save_upload in includes/file.inc
Saves a file upload to a new location.
file_transfer in includes/file.inc
Transfer file using HTTP to client. Pipes a file through Drupal to the client.
file_unmanaged_copy in includes/file.inc
Copy a file to a new location without calling any hooks or making any changes to the database.
hook_file_download in modules/system/system.api.php
Control access to private file downloads and specify HTTP headers.
LocaleUninstallFunctionalTest::testUninstallProcess in modules/locale/locale.test
Check if the values of the Locale variables are correct after uninstall.
locale_js_alter in modules/locale/locale.module
Implementation of hook_js_alter().
locale_uninstall in modules/locale/locale.install
Implementation of hook_uninstall().
upload_file_download in modules/upload/upload.module
Implementation of hook_file_download().
user_admin_settings in modules/user/user.admin.inc
Form builder; Configure user settings for this site.
user_file_download in modules/user/user.module
Implementation of hook_file_download().
user_save in modules/user/user.module
Save changes to a user account or add a new user.
_locale_rebuild_js in includes/locale.inc
(Re-)Creates the JavaScript translation file for a language.

Code

includes/file.inc, line 111

<?php
function file_create_path($destination = NULL) {
  $file_path = file_directory_path();
  if (is_null($destination)) {
    return $file_path;
  }
  // file_check_location() checks whether the destination is inside the Drupal
  // files directory.
  if (file_check_location($destination, $file_path)) {
    return $destination;
  }
  // Check if the destination is instead inside the Drupal temporary files
  // directory.
  elseif (file_check_location($destination, file_directory_temp())) {
    return $destination;
  }
  // Not found, try again with prefixed directory path.
  elseif (file_check_location($file_path . '/' . $destination, $file_path)) {
    return $file_path . '/' . $destination;
  }
  // File not found.
  return FALSE;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen