file_uri_target

Versions
7
file_uri_target($uri)

Returns the target of a URI (e.g. a stream).

Parameters

$uri A stream, referenced as "scheme://target".

Return value

A string containing the target (path), or FALSE if none. For example, the URI "public://sample/test.txt" would return "sample/test.txt".

Related topics

▾ 8 functions call file_uri_target()

drupal_dirname in includes/file.inc
Gets the name of the directory from a given path.
file_stream_wrapper_uri_normalize in includes/file.inc
Normalizes a URI by making it syntactically correct.
file_test_file_url_alter in modules/simpletest/tests/file_test.module
Implements hook_file_url_alter().
hook_file_url_alter in modules/system/system.api.php
Alter the URL to a file.
image_file_download in modules/image/image.module
Implements hook_file_download().
image_style_path in modules/image/image.module
Return the URI of an image when using a style.
image_style_url in modules/image/image.module
Return the URL for an image derivative given a style and image path.
user_file_download in modules/user/user.module
Implements hook_file_download().

Code

includes/file.inc, line 181

<?php
function file_uri_target($uri) {
  $data = explode('://', $uri, 2);

  if (count($data) != 2) {
    return FALSE;
  }

  // Remove erroneous beginning forward slash.
  $data[1] = ltrim($data[1], '\/');

  return $data[1];
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.