# Image refresh after upload on same view?

**URL:** <https://www.ruby-forum.com/t/image-refresh-after-upload-on-same-view/69040>\
**Category:** Rails\
**Created:** [September 18, 2006, 10:49am UTC](https://www.ruby-forum.com/t/image-refresh-after-upload-on-same-view/69040 "2006-09-18T10:49:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/13edae/32.png) [@sine](https://www.ruby-forum.com/u/sine)\
**Post date:** [September 18, 2006, 10:49am UTC](https://www.ruby-forum.com/t/image-refresh-after-upload-on-same-view/69040/1 "2006-09-18T10:49:41Z")

</div>

hi everybody

i have a problem with refreshing an image after uploading it on the same  
view.  
i have redirect\_to ‘my view’ in my upload method in the same controller  
after handling image upload.  
the image should be refreshed but the view is still showing old image.  
when i push refresh button in browser the image gets refreshed.

any suggestions?

ps: i tried in firefox and ie also.

thank you

---

<div class="post-metadata">

**Author:** ![sine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/13edae/32.png) [@sine](https://www.ruby-forum.com/u/sine)\
**Post date:** [September 18, 2006, 11:19am UTC](https://www.ruby-forum.com/t/image-refresh-after-upload-on-same-view/69040/2 "2006-09-18T11:19:08Z")

</div>

Add this code in the my view…

sine wrote:

> hi everybody
> 
> i have a problem with refreshing an image after uploading it on the same  
> view.  
> i have redirect\_to ‘my view’ in my upload method in the same controller  
> after handling image upload.  
> the image should be refreshed but the view is still showing old image.  
> when i push refresh button in browser the image gets refreshed.
> 
> any suggestions?
> 
> ps: i tried in firefox and ie also.
> 
> thank you

---

<div class="post-metadata">

**Author:** ![sine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/13edae/32.png) [@sine](https://www.ruby-forum.com/u/sine)\
**Post date:** [September 18, 2006, 2:07pm UTC](https://www.ruby-forum.com/t/image-refresh-after-upload-on-same-view/69040/3 "2006-09-18T14:07:55Z")

</div>

Naga harish Kanegolla wrote:  
i tried but still dont work, and my browser shows me javascript error =  
window.opener is null not an object?

> Add this code in the my view…
> 
> sine wrote:
> 
> > hi everybody
> > 
> > i have a problem with refreshing an image after uploading it on the same  
> > view.  
> > i have redirect\_to ‘my view’ in my upload method in the same controller  
> > after handling image upload.  
> > the image should be refreshed but the view is still showing old image.  
> > when i push refresh button in browser the image gets refreshed.
> > 
> > any suggestions?
> > 
> > ps: i tried in firefox and ie also.
> > 
> > thank you

---

<div class="post-metadata">

**Author:** ![sine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/13edae/32.png) [@sine](https://www.ruby-forum.com/u/sine)\
**Post date:** [September 18, 2006, 3:19pm UTC](https://www.ruby-forum.com/t/image-refresh-after-upload-on-same-view/69040/4 "2006-09-18T15:19:22Z")

</div>

Try this,  
add this code in the method “save”.  
def save  
if @picture.save  
redirect\_to :action =\> ‘saved\_picture’  
return  
end  
end  
and in saved\_picture.rhtml u put this,

I think it should work…

Harish
