# Update picture and not show the one in the browser cache?

**URL:** <https://www.ruby-forum.com/t/update-picture-and-not-show-the-one-in-the-browser-cache/144778>\
**Category:** Rails\
**Created:** [August 1, 2008, 11:33pm UTC](https://www.ruby-forum.com/t/update-picture-and-not-show-the-one-in-the-browser-cache/144778 "2008-08-01T23:33:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [August 1, 2008, 11:33pm UTC](https://www.ruby-forum.com/t/update-picture-and-not-show-the-one-in-the-browser-cache/144778/1 "2008-08-01T23:33:41Z")

</div>

Hi,

I’m able to upload a pic and updated it later.  
My problem now is that after uploading the old picture is shown, it is  
taken from the browser cache I guess.

In my app I only cache js and css.

I’ve tried:

expire\_page “/tabs/#{@tab.id}”  
redirect\_to(@tab)

But it doesn’t go away until I press F5 in the browser. Then the update  
picture is shown.

Any hints?

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [August 2, 2008, 9:53pm UTC](https://www.ruby-forum.com/t/update-picture-and-not-show-the-one-in-the-browser-cache/144778/2 "2008-08-02T21:53:48Z")

</div>

Hi,

In case anyone is interested I’ve solved my problem by adding a  
timestamp to the picture name. That way the picture changes name when  
updated so cache is not affecting at all.

Cheers.

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [August 3, 2008, 12:54pm UTC](https://www.ruby-forum.com/t/update-picture-and-not-show-the-one-in-the-browser-cache/144778/3 "2008-08-03T12:54:48Z")

</div>

On Sat, Aug 2, 2008 at 3:53 PM, comopasta Gr \<  
removed\_email\_address@domain.invalid\> wrote:

> Hi,
> 
> In case anyone is interested I’ve solved my problem by adding a  
> timestamp to the picture name. That way the picture changes name when  
> updated so cache is not affecting at all.

Did you add the timestamp as a GET variable, or as part of the actual  
filename? How did you do it?

Rails adds the timestamp as a GET variable for CSS and JS files  
(“style.css?185673820” instead of “style\_185673820.css”).

–  
Tim
