1 file.pages.inc file_upload_destination_uri(array $params, array $data = array())

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()

File

core/modules/file/file.pages.inc, line 427
Supports file operations including Manage and Delete.

Code

function file_upload_destination_uri(array $params, array $data = array()) {
  $params += array(
    'uri_scheme' => file_default_scheme(),
    'file_directory' => '',
  );

  $destination = trim($params['file_directory'], '/');

  // Replace tokens.
  $destination = token_replace($destination, $data);

  return $params['uri_scheme'] . '://' . $destination;
}