function file_uri_scheme

file_uri_scheme($uri)

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

Parameters

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

Return value

A string containing the name of the scheme, or FALSE if none. For example, the URI "public://example.txt" would return "public".

See also

file_uri_target()

Related topics

File

includes/file.inc, line 199
API for handling file uploads and server file management.

Code

function file_uri_scheme($uri) {
  $position = strpos($uri, '://');
  return $position ? substr($uri, 0, $position) : FALSE;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!file.inc/function/file_uri_scheme/7.x