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