1 file.module file_is_writeable($file)

Check if a file entity is considered writeable or not.


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.


core/modules/file/file.module, line 2542
Defines a "managed_file" Form API field and a "file" field for Field module.


function file_is_writeable($file) {
  $scheme = file_uri_scheme($file->uri);
  $wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE);
  return !empty($wrappers[$scheme]);