You are here

function file_entity_file_is_writeable in File Entity (fieldable files) 7.3

Same name and namespace in other branches
  1. 7.2 file_entity.module \file_entity_file_is_writeable()

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.

2 calls to file_entity_file_is_writeable()
file_entity_add_upload_submit in ./file_entity.pages.inc
Submit handler for the add file form.
file_entity_edit in ./file_entity.pages.inc
Page callback: Form constructor for the file edit form.

File

./file_entity.module, line 2325
Extends Drupal file entities to be fieldable and viewable.

Code

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