function file_valid_uri in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/includes/file.inc \file_valid_uri()
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().
Parameters
$uri: The URI to be tested.
Return value
TRUE if the URI is allowed.
Related topics
4 calls to file_valid_uri()
- file_copy in core/
modules/ file/ file.module - Copies a file to a new location and adds a file record to the database.
- file_move in core/
modules/ file/ file.module - Moves a file to a new location and update the file's database entry.
- file_save_data in core/
modules/ file/ file.module - Saves a file to the specified destination and creates a database entry.
- LibraryDiscoveryParser::fileValidUri in core/
lib/ Drupal/ Core/ Asset/ LibraryDiscoveryParser.php - Wraps file_valid_uri().
File
- core/
includes/ file.inc, line 407 - API for handling file uploads and server file management.
Code
function file_valid_uri($uri) {
// Assert that the URI has an allowed scheme. Bare paths are not allowed.
$uri_scheme = \Drupal::service('file_system')
->uriScheme($uri);
if (!file_stream_wrapper_valid_scheme($uri_scheme)) {
return FALSE;
}
return TRUE;
}