I had a folder outside public_html which contained files that needed to be available for download to certain users.

The problem was that the files where not downloading correctly in various browsers - eg a pdf file would download correctly in firefox but ie would display this message:

"internet explorer cannot download

internet explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.

The problem was with the headers. The following headers work with IE6, Firefox and IE7. "

<?php
  $header[] = "Pragma: public";
  $header[] = "Expires: 0";
  $header[] = "Cache-Control: must-revalidate, post-check=0, pre-check=0";
  $header[] = "Cache-Control: public";
  $header[] = "Content-Description: File Transfer";
  $header[] = "Content-type: application/octet-stream";
  $header[] = "Content-Disposition: attachment; filename=\"$filename\"";
  $header[] = "Content-Transfer-Encoding: binary";
  $header[] = "Content-Length: " .filesize($file);
?>

code a combination from quickfile module, http://richardlynch.blogspot.com/2006_06_01_archive.html, and http://www.zubrag.com/scripts/download.php .

Please post headers here that you know that works with a wide variety of browsers!

Comments

agentrickard’s picture

If the default headers supplied by a module (drupal core or contrib) are not working, you need to file a bug report with the affected module.

Accumulating header lists in the forms will not help solve the problem effectively.
--
http://ken.blufftontoday.com/
http://new.savannahnow.com/user/2
Search first, ask good questions later.