Determines whether the URI has a valid scheme for file API operations.
There must be a scheme and it must be a Drupal-provided scheme like 'public', 'private', 'temporary', or an extension provided with hook_stream_wrappers().
$uri: The URI to be tested.
TRUE if the URI is allowed.
function file_valid_uri($uri) {
// Assert that the URI has an allowed scheme. Barepaths are not allowed.
$uri_scheme = file_uri_scheme($uri);
if (!file_stream_wrapper_valid_scheme($uri_scheme)) {
return FALSE;
}
return TRUE;
}