hello all,
I m uploading an image in php page and path of image is saving in db. but after 2nd or 3rd itteration there previous image is displayed. When i refresh that page then new uploaded image display.
please tell me way of clearing cache of browser on runtime of php application or any other way of solving this problem
thanks in advance . . .
How can I clear cache of browser on runtime
Moderator: General Moderators
Re: How can I clear cache of browser on runtime
are you serving the image directly or from php script?
-
naveed82
- Forum Newbie
- Posts: 7
- Joined: Thu Feb 28, 2008 12:01 am
- Location: Islamabad, Pakistan
- Contact:
Re: How can I clear cache of browser on runtime
Yes, we are using PHP script from getting path of image (which is on locally on system) from DB and then display on php page in application ...
Re: How can I clear cache of browser on runtime
header("Cache-Control: no-cache");
you can try something like this as one of the headers when displaying the image.
you can try something like this as one of the headers when displaying the image.
-
naveed82
- Forum Newbie
- Posts: 7
- Joined: Thu Feb 28, 2008 12:01 am
- Location: Islamabad, Pakistan
- Contact:
Re: How can I clear cache of browser on runtime
i have checked these snappits of code for this problem ...
// 1st snappit
header("cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
//2nd snappit
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Data passata
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// sempre modificato
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
but these snappits are not working as my requirement.
// 1st snappit
header("cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
//2nd snappit
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Data passata
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// sempre modificato
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
but these snappits are not working as my requirement.
Re: How can I clear cache of browser on runtime
some tough browser you have there 
-
naveed82
- Forum Newbie
- Posts: 7
- Joined: Thu Feb 28, 2008 12:01 am
- Location: Islamabad, Pakistan
- Contact:
Re: How can I clear cache of browser on runtime
-
naveed82
- Forum Newbie
- Posts: 7
- Joined: Thu Feb 28, 2008 12:01 am
- Location: Islamabad, Pakistan
- Contact:
Re: How can I clear cache of browser on runtime
thanks for you coporation ..
i have solved this problem using the statement given below:
<img src="someimage.png?x=<?=uniqid((double)microtime()*1000000,1)?>">
thanks again
i have solved this problem using the statement given below:
<img src="someimage.png?x=<?=uniqid((double)microtime()*1000000,1)?>">
thanks again