Browse Source

some datastreams were downloading into

files without extensions
pull/255/head
William Panting 12 years ago
parent
commit
67308b17d7
  1. 6
      includes/datastream.inc

6
includes/datastream.inc

@ -37,7 +37,11 @@ function islandora_view_datastream(FedoraDatastream $datastream, $download = FAL
header('Content-length: ' . $datastream->size); header('Content-length: ' . $datastream->size);
} }
if ($download) { if ($download) {
header("Content-Disposition: attachment; filename=\"{$datastream->label}\""); // Browsers will not append all extensions.
$mime_detect = new MimeDetect();
$extension = $mime_detect->getExtension($datastream->mimetype);
$filename = $datastream->label . '.' . $extension;
header("Content-Disposition: attachment; filename=\"$filename\"");
} }
drupal_page_is_cacheable(FALSE); drupal_page_is_cacheable(FALSE);
// Try not to load the file into PHP memory! // Try not to load the file into PHP memory!

Loading…
Cancel
Save