Jump to content


Photo

Excel Caching Issue


  • Please log in to reply
1 reply to this topic

#1 jayR

jayR
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 31 July 2006 - 06:37 PM

Hello.  I'm generating some stats in my php script and I am also generating an excel file at the same time so that it can be downloaded and worked with.  The problem is that for some reason the Excel file won't update when the stats do, like its cached or something.  The file on the server is updated but thats it.  I know that you need headers to tell it not to cache, but I don't know where to put the headers.  The page the link is on currently has these headers:

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-cache, must-revalidate" );
header("Pragma: no-cache" );
header("Content-Type: text/html; charset=utf-8");

and has other information that shouldn't be cached on it and it is working fine.  I also found a post that says to use these headers:

header("Content-type: application/vnd.ms-excel");
header("Content-disposition: attachment; filename=$csvnameext­");
header("Expires: Mon, 3 Jan 2000 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");

These, however, make links pointing to this page treat it like an excel document, not a web page that simply has a link to an excel document.  If theres anything else you need to help solve this let me know.  Thanks.

#2 jayR

jayR
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 01 August 2006 - 12:26 PM

sorry to bump, but I could really use help on this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users