function file_uri_target

Returns the part of a URI after the schema.


$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".

See also


Related topics

16 calls to file_uri_target()
file_stream_wrapper_uri_normalize in drupal/includes/
Normalizes a URI by making it syntactically correct.
file_test_file_url_alter in drupal/modules/simpletest/tests/file_test.module
Implements hook_file_url_alter().
hook_file_download in drupal/modules/system/system.api.php
Control access to private file downloads and specify HTTP headers.
hook_file_url_alter in drupal/modules/system/system.api.php
Alter the URL to a file.
ImageStylesPathAndUrlTestCase::_testImageStyleUrlAndPath in drupal/modules/image/image.test
Test image_style_url().

... See full list


drupal/includes/, line 243
API for handling file uploads and server file management.


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

  // Remove erroneous leading or trailing, forward-slashes and backslashes.
  return count($data) == 2 ? trim($data[1], '\\/') : FALSE;