1 file.module | file_is_local($file) |
Check if a file entity is considered local or not.
Parameters
object $file: A file entity object from file_load().
Return value
TRUE if the file is using a local stream wrapper, or FALSE otherwise.:
File
- core/
modules/ file/ file.module, line 2549 - Defines a "managed_file" Form API field and a "file" field for Field module.
Code
function file_is_local($file) {
$scheme = file_uri_scheme($file->uri);
$wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_LOCAL);
return !empty($wrappers[$scheme]) && empty($wrappers[$scheme]['remote']);
}