function file_uri_target

Same name and namespace in other branches
  1. 8.9.x core/includes/file.inc \file_uri_target()

Returns the part of a URI after the schema.

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

See also

file_uri_scheme()

Related topics

18 calls to file_uri_target()
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().
file_uri_normalize_dot_segments in includes/file.inc
Normalize dot segments in a URI.
hook_file_download in modules/system/system.api.php
Control access to private file downloads and specify HTTP headers.
hook_file_url_alter in modules/system/system.api.php
Alter the URL to a file.

... See full list

File

includes/file.inc, line 250

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.