jayR Posted July 31, 2006 Share Posted July 31, 2006 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. Quote Link to comment Share on other sites More sharing options...
jayR Posted August 1, 2006 Author Share Posted August 1, 2006 sorry to bump, but I could really use help on this Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.