8.5.x file.inc file_uri_scheme($uri)
8.0.x file.inc file_uri_scheme($uri)
8.1.x file.inc file_uri_scheme($uri)
8.2.x file.inc file_uri_scheme($uri)
8.3.x file.inc file_uri_scheme($uri)
8.4.x file.inc file_uri_scheme($uri)
8.6.x file.inc file_uri_scheme($uri)
7.x file.inc 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

21 calls to file_uri_scheme()
drupal_dirname in includes/file.inc
Gets the name of the directory from a given path.
drupal_rmdir in includes/file.inc
Removes a directory.
drupal_tempnam in includes/file.inc
Creates a file with a unique filename in the specified directory.
drupal_unlink in includes/file.inc
Deletes a file.
FileSaveDataTest::testExistingRename in modules/simpletest/tests/file.test
Test file_save_data() when renaming around an existing file.

... See full list

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