Temporary Internet Files\Content.IE5\ could not be found


I created a restricted file download area for a client website, for their clients to download spreadsheets from their site. A problem arose where I got an error message (in Windows) when opening the file directly in Internet Explorer 6, and choosing ‘open’ instead of ‘save’ on the File Download popup. But when opening the same link in Firefox, it opens successfully! This is the error message one gets:

‘C:\Documents and Settings\\Local Settings\Temporary Internet Files\Content.IE5\’ could not be found

It also seems to be an issue in some other Microsoft software (such as Outlook) as well. The error was not given in Internet Explorer, but in whatever program is set to open the file, such as OpenOffice or Excel. The error message differs a little according to the program used, but the problem is that the temporary file cannot be found.


After trying many things, I found that the problem I was experiencing has to do with cache headers. In PHP, one can stop the caching of content by serving headers similar to:

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

But when a site’s cache headers are set to not cache the content in that way, it seems that some Microsoft products don’t save the temporary file at all. The program then tries to open a file which just doesn’t exist!

To see it in action, try to open this file in Internet Explorer. When prompted to “open” or “save” the file, choose “open” — when a program like Excel or OpenOffice opens the document, an error message is received.

The solution is to instruct the user’s computer to cache the file for a short amount of time, so that the temporary file is created and the program has something to open. When one now tries to open the same file (in Internet Explorer), but with the cache headers in place, the file opens successfully.

To cache a file for 30 seconds, and overwrite any previous cache directives, send the following headers with PHP :

header('Content-Type: application/vnd.ms-excel');
header("Content-Length: " . filesize($file));
header('Content-Disposition: attachment; filename="'.$filename.'"');

/* cache */
header("Date: " . gmdate("D, j M Y H:i:s ", time()) . 'GMT');
header("Expires: " . gmdate("D, j M Y H:i:s", time() + 30) . " GMT");
header("Cache-Control: public"); // HTTP/1.1
header("Pragma: public");        // HTTP/1.0


It would be interesting to know whether this is only a problem in Windows and Internet Explorer, or in other browsers or operating systems as well. Please leave a comment and let everyone know whether directly opening (instead of first saving and then opening locally) the problem file also gives you an error (or not), and which operating system and browser you used!

4 Responses to “Temporary Internet Files\Content.IE5\ could not be found”

  1. Hi Braam

    Maybe the link was broken?????

    Ai tog!!!

    • Abraham says:

      Hi Anton,

      Thank you for the comment.

      The problem only appears in Internet Explorer when opening the file directly — when opening the same file via Firefox, the file opens without a problem.

      Also, if the link was broken, everyone would receive a “404 Not Found” error when clicking the link. One can however choose to “save” the file first and then open it on your own computer — it opens without error. This again shows that the file does indeed exist and that the link isn’t broken.

      I’ve updated the article to make this more clear, and added examples to show the problem.

  2. akoymakoy says:

    Hi would you be able to suggest a fix on JSPs instead of php

    • Abraham says:

      @akoymakoy We haven’t worked with JSP before, so I won’t be able to provide a JSP implementation. But the headers are HTTP headers, and though I’ve used PHP to construct and send them, other languages should also have a way of sending these same headers back to the client. In other words, whichever language you use to send them, the headers would stay the same, and you would just need to replace the PHP functions that I’ve used to create the headers (eg. filesize, time, date, ..) with the equivalent functions in your language of choice, such as JSP.

Leave a Reply