Let me explain the need for this. I have a page where user can upload his profile picture if he needs to change it. On submission of that form i am suppose to show him his profile page.
But the issue is this, Both his old profile image & his new profile image which gets uploaded are stored by same name & same extension(this is required, i cannot change this else i wouldnt have had the problem if i had changed the name of the new image)
So when he is redirected to his profile page, still the old image shows up unless the user hits Ctrl+F5. So is there any way to solve this ?
P.S : I know abt random query string on img src method. But i dont want that since it will always get image from server. I just want the browser not to cache the image only on this particular request(eg setting status header in function which redirects after image upload). I am using Codeigniter, PHP
Try $this->output->set_header();
for the image.
Permits you to manually set server headers, which the output class will send for you when outputting the final rendered display.
$this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_update).' GMT');
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0");