The Little Guy Posted May 17, 2012 Share Posted May 17, 2012 I need to know when a file was last modified to see if the browser has an updated cached version, if the browser does use its cache otherwise get the most current version. How can I do this? Quote Link to comment https://forums.phpfreaks.com/topic/262694-cache-a-file/ Share on other sites More sharing options...
mrMarcus Posted May 17, 2012 Share Posted May 17, 2012 filemtime might be what you're looking for. Quote Link to comment https://forums.phpfreaks.com/topic/262694-cache-a-file/#findComment-1346429 Share on other sites More sharing options...
The Little Guy Posted May 17, 2012 Author Share Posted May 17, 2012 no, that is the time the file was modified on the server, I want something that gives me when the file was last downloaded or something like that. I have this: header("Cache-Control: private, max-age=10800, pre-check=10800"); header("Pragma: private"); // Set to expire in 2 days header("Expires: " . date(DATE_RFC822,strtotime(" 2 day"))); if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])){ // if the browser has a cached version of this image, send 304 header('Last-Modified: '.$_SERVER['HTTP_IF_MODIFIED_SINCE'],true,304); exit; } But it only seems to work on Apache. Quote Link to comment https://forums.phpfreaks.com/topic/262694-cache-a-file/#findComment-1346450 Share on other sites More sharing options...
mrMarcus Posted May 18, 2012 Share Posted May 18, 2012 I need to know when a file was last modified no, that is the time the file was modified Make up your mind. I want something that gives me when the file was last downloaded or something like that Downloaded by whom? Something like what? Please include more details. Quote Link to comment https://forums.phpfreaks.com/topic/262694-cache-a-file/#findComment-1346592 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.