You are here

function file_entity_upload_destination_uri in File Entity (fieldable files) 7.2

Same name and namespace in other branches
  1. 7.3 file_entity.pages.inc \file_entity_upload_destination_uri()

Determines the upload location for the file add upload form.

Parameters

array $params: An array of parameters from the media browser.

array $data: (optional) An array of token objects to pass to token_replace().

Return value

string A file directory URI with tokens replaced.

See also

token_replace()

1 call to file_entity_upload_destination_uri()
file_entity_add_upload_step_upload in ./file_entity.pages.inc
Generate form fields for the first step in the add file wizard.

File

./file_entity.pages.inc, line 663
Supports file operations including View, Edit, and Delete.

Code

function file_entity_upload_destination_uri(array $params, array $data = array()) {
  $params += array(
    'uri_scheme' => file_default_scheme(),
    'file_directory' => variable_get('file_entity_default_file_directory', ''),
  );
  $destination = trim($params['file_directory'], '/');

  // Replace tokens.
  $destination = decode_entities(token_replace($destination, $data));
  return $params['uri_scheme'] . '://' . $destination;
}