Closed (works as designed)
Project:
File MIME
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Jun 2010 at 12:09 UTC
Updated:
10 May 2013 at 06:59 UTC
Hi
If you add:
function filemime_file_download($filename) {
$fullpath = file_create_path($filename);
if (file_exists($fullpath)) {
$filesize = filesize($fullpath);
return array(
'Content-Type: '. mime_header_encode(file_get_mimetype($filename)),
'Content-Length: '. $filesize,
);
}
return -1;
}
to the filemime.module it solves the problem that user have when downloading files with
private download method (ie Drupal always returns text/plain as mime type)!
This will make this module (even without overrides) even much more usefull!
Comments
Comment #1
mfbI dont think this is needed, since modules that allow for uploading/downloading files like upload or filefield should be setting the Content-Type themselves in their hook_file_download(). Maybe some other module you're using doesn't do this, which causes your "always returns text/plain" problem?
Comment #2
mfbComment #3
wvd_vegt commentedHi,
If my memory is correct we only used std Drupal for this (so it's plain vanilla drupal that does this, it probably does not contain the hook). Normally this isn't a problem unless your browser refuses to download without ir being correct. I think only firefox has/had problems with it.
Comment #4
mfb"std Drupal" already implements the hook to add proper Content-Type header, see http://api.drupal.org/api/drupal/modules--upload--upload.module/function... and http://api.drupal.org/api/drupal/modules--user--user.module/function/use...
Comment #5
mfb