Browse Source

Added mimetype as an optional param to islandora_temp_file_entry().

pull/476/head
MorganDawe 11 years ago
parent
commit
dbdeb0ae2c
  1. 5
      includes/utilities.inc

5
includes/utilities.inc

@ -55,7 +55,7 @@ function islandora_convert_bytes_to_human_readable($bytes, $precision = 2) {
* @return object * @return object
* The file, as returned from file_save(). * The file, as returned from file_save().
*/ */
function islandora_temp_file_entry($file_uri) { function islandora_temp_file_entry($file_uri, $mime = NULL) {
$query = new EntityFieldQuery(); $query = new EntityFieldQuery();
$result = $query $result = $query
->entityCondition('entity_type', 'file') ->entityCondition('entity_type', 'file')
@ -69,6 +69,9 @@ function islandora_temp_file_entry($file_uri) {
$file = new stdClass(); $file = new stdClass();
$file->uri = $file_uri; $file->uri = $file_uri;
$file->filename = drupal_basename($file_uri); $file->filename = drupal_basename($file_uri);
if (isset($mime)) {
$file->filemime = $mime;
}
} }
$file->status = 0; $file->status = 0;
return file_save($file); return file_save($file);

Loading…
Cancel
Save