You are here

function block_upload_get_upload_destination in Block Upload 7

Returns destinaton for file upload.

Return value

string Destination path.

2 calls to block_upload_get_upload_destination()
block_upload_form in ./block_upload.module
Block upload form.
block_upload_plupload_form_submit in ./block_upload.module
Saves files uploaded via plupload form.

File

./block_upload.module, line 355
Block Upload module.

Code

function block_upload_get_upload_destination($field) {
  if ($destination = $field['settings']['file_directory']) {
    if (module_exists('token')) {
      $node = menu_get_object();
      $destination = token_replace($destination, array(
        'node' => $node,
      ));
    }
  }
  $field_info = field_info_field($field['field_name']);
  $uri_scheme = $field_info['settings']['uri_scheme'];
  if (!$uri_scheme) {
    $uri_scheme = 'public';
  }
  $destination = $uri_scheme . '://' . $destination;
  file_prepare_directory($destination, FILE_CREATE_DIRECTORY);
  return $destination;
}