Hi,

I am using the filestore2 module to store all kinds of files. While developing my Drupal site I used Firefox and everything seemed to work nice. I Added some users to my site to get some feedback about how things are working and configured. And at this point I discovered IE users could not open PDF files. In Q3 2004 Microsoft released a patch to repair a security risk in download.ject adodb.stream. This patch seems to be the cause for IE users not to be able to download PDF files (office- and jpg's are no problem). I have tried the administer->settings-> private / public download but that doesn't resolve the problem. I also cannot migrate my users (about 10.000) to firefox.
In fact there is a work-a-round (right click->save target as...) but it is quite unconvenient.

Is there anyway other way to resolve this?

Your response is welcome!

Rob.

Comments

Aran Deltac’s picture

I'm very curious about this. Would it be possible for you to provide a link where we can try viewing a pdf on your site?

--
http://www.electroniclife.org/

Otrebor’s picture

I'm sorry. But it is -not yet- on the internet. I can send you some screenshots if you like?

Otrebor’s picture

Maybe this is a clue to what is happening :

http://support.microsoft.com/default.aspx? scid=kb;en-us;253213

In this article it describes the situation where IE requests a file using the post method and tries to pull the file from the internet cache instead of the correct location (the web server).
I wonder why it is that only with pdf files this problem occurs .....
Do you or anyone else know of a way to work-a-round this? MS suggests to change the web application to use the get method?

Rob.

quickcel’s picture

I am getting a similar problem you described with .pdf and .xls files not opening correctly in IE, but will open in firefox.

With .pdf I get an error message that reads "There was an error opening this document. The file could not be found."

With .xls I get an error message that says something to the effect of path name could not be found please make sure spelling and location of file are correct

As was mentioned for a workaround, in IE I can save the file to my desktop and then sucessfully open it from there.

This seems to happen with .pdf and .xls, while .txt and .doc work no problem.

Another difference is that all files open correctly when using the public file system. This problem seems to occur only with the private file system enabled.

Did you have any luck finding a solution to this problem?

-------
Drupal: 4.6.3
PHP: 5.0.4

respinos’s picture

IE has issues downloading files if there are expiration headers sent in the response. You can try setting the response headers to

    Expires: 0
    Pragma: cache
    Cache-Control: private

and see if this helps.

quickcel’s picture

Thanks for the help. I disabled cache support in administer --> settings and can now open the documents in IE no problems.

-------
Drupal: 4.6.3
PHP: 5.0.4

Jhef.Vicedo’s picture

Nice... this solution works. Just add the above headers to upload_file_download() method. Something like this:

function upload_file_download($file) {
  if (user_access('view uploaded files')) {
    $file = file_create_path($file);
    $result = db_query(db_rewrite_sql("SELECT f.nid, f.* FROM {files} f WHERE filepath = '%s'", 'f'), $file);
    if ($file = db_fetch_object($result)) {
      $name = mime_header_encode($file->filename);
      $type = mime_header_encode($file->filemime);
      // Serve images and text inline for the browser to display rather than download.
      $disposition = ereg('^(text/|image/)', $file->filemime) ? 'inline' : 'attachment';
      return array('Content-Type: '. $type .'; name='. $name,
                   'Content-Length: '. $file->filesize,
                   'Content-Disposition: '. $disposition .'; filename='. $name,
                   'Expires: 0', 'Pragma: cache', 'Cache-Control: private');
    }
  }
}

And maybe this can fix some modules that are also having this problem, modules implementing hook_file_download()...

Work smarter, not harder!
jeff [at] digitalsolutions [dot] ph

jhefmv [at] gmail [dot] com
Work smarter, not harder!

shrop’s picture

Thanks so much! This fix worked great. I was having many issues with this as I use private files for many of my sites.

Thanks,
Mark

ysanchez’s picture

In fact I just added the line:

'Expires: 0', 'Pragma: cache', 'Cache-Control: private');

Tx a lot

Yvan