What is the best way to refresh the browser screen through PHP.
Problem: Have an image displayed on a page and use file menu to pick a new file. The file replaces the existing filem but the filename remains the same. Next time I visit this page, the old image (cached) appears with the new image width/height size. I would like to force a refresh of the browser from within PHP. Any ideas?
Thanx
crandym
How to refresh browser from PHP code
Moderator: General Moderators
PHP can't refresh a page, say every 5 seconds, or whatever. To do that you're gonna need to use Javascript. However, it sounds like what you've got is just a caching problem. Putting these three meta tags in my files has stopped caching on any pages I've used.
<meta http-equiv="Cache-Control" Content="no-cache">
<meta http-equiv="Pragma" Content="no-cache">
<meta http-equiv="Expires" Content="0">
<meta http-equiv="Cache-Control" Content="no-cache">
<meta http-equiv="Pragma" Content="no-cache">
<meta http-equiv="Expires" Content="0">
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
I've reviewed several forum topics on several websites on this particular topic. I'll be more specfic about this issue.
1. Application I am debugging is a single php page which contains a duel function - if called by itself (i.e., story.php), provide list of times that can be edited, if called with values (i.e., story.php?story=22) activites an html editing screen with a submit button. The submit button calls another file story_submit.php which update the database and then does a "header('Location: '.$HTTP_POST_VARS['destination']);" which goes back to story.php page.
If on the data editing portion of this page, you use html "<td align="center"><input type="file" name="picture" size="40"></td>" to load a new image which works fine. When you submit, the data is stored correctly in the database and directory. But when you go to edit the data again, the old image appears with the new images size. PHP code is looking at the new image file and creating the w/h footprint, but the actual image is the old image coming from cache (i.e., because the filenames are the same).
All I'm looking for is a simply way to trigger the Browsers refresh function 1 time.
1. Application I am debugging is a single php page which contains a duel function - if called by itself (i.e., story.php), provide list of times that can be edited, if called with values (i.e., story.php?story=22) activites an html editing screen with a submit button. The submit button calls another file story_submit.php which update the database and then does a "header('Location: '.$HTTP_POST_VARS['destination']);" which goes back to story.php page.
If on the data editing portion of this page, you use html "<td align="center"><input type="file" name="picture" size="40"></td>" to load a new image which works fine. When you submit, the data is stored correctly in the database and directory. But when you go to edit the data again, the old image appears with the new images size. PHP code is looking at the new image file and creating the w/h footprint, but the actual image is the old image coming from cache (i.e., because the filenames are the same).
All I'm looking for is a simply way to trigger the Browsers refresh function 1 time.