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