[support] private file downloads don't work with IE8 only when using hook_file_download

John Mitchell mitchelljj98 at gmail.com
Sat Jun 15 16:41:37 UTC 2013


I am trying to allow files that are within the
"/sites/default/files/private/" directory to available to users with
correct role and this is working correctly within all browsers (including
IE9) except for the IE8 browser.
It does not appear to be a particular file type since it does not work with
either .pdf's or .doc's extension.
Is their something special that I need to do to the "mime type" so that IE8
will successfully download these files?
I have listed below "hook_file_download" which determines when a requested
file download is allowed based on a combination of the page $url and the
requesting users role and I highlighted in bold the bottom of the function
where it determines the mime type that is returned.

Thanks,

John

function atf_retirees_file_download($uri) {
  $user = $GLOBALS['user'];
  $roles = $user->roles;
  $pos_inside_atf_alias = stripos($uri, '/inside-atf/');
  $pos_nibin_alias = stripos($uri, '/nibin-user-area/');
  if (($pos_inside_atf_alias === false && $pos_nibin_alias === false) ||
($pos_inside_atf_alias !== false && !(in_array('ATF Retirees', $roles) ||
in_array('administrator', $roles))) || ($pos_nibin_alias !== false &&
!(in_array('NIBIN User Area', $roles) || in_array('administrator',
$roles)))) {
    return -1;
  } else {
    *$mime_type = file_get_mimetype($uri);*
*    return array('Content-Type' => $mime_type);*
  }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20130615/1983b5c3/attachment.html 


More information about the support mailing list