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

mfb’s picture

I 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?

mfb’s picture

Status: Active » Postponed (maintainer needs more info)
wvd_vegt’s picture

Hi,

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.

mfb’s picture

mfb’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)