Re: header and no refresh
| From: | Rasmus Lerdorf | Date: | Mon, 05 Jun 2000 17:15:14 +0000 |
| Subject: | Re: header and no refresh | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1063@lists.php.net to get a copy of this message | ||
> I'm allowing a user to update their profile. In their profile, they can
> upload a picture. I store the picture as there userid plus the correct
> extension. The problem is that when they upload a new pic with the same
> extension as the old pic, it doesn't show the change until they either
> refresh the screen or close and reopen the browser. I tried to send the
> following headers:
>
> header("Pragma: no-cache");
> header("Cache-Control: no-cache, must-revalidate, pre-check=0");
> header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
> header("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
>
> They get set just fine(checked phpinfo) but the image still gets cached. Is
> there a way to get the image to not cache? If it matters, the image is
> stored in a directory and the path is stored in a mysql database. Any help
> is greatly appreciated.
A really simplistic way to fix this would be to make your img tag look
like this:
<img src="/path/image.jpg?defeatsillycache=<?echo time()?>">
-Rasmus