views:

54

answers:

1

Hi, I am uploading images to S3 storage by using paperclip plugin. its uploaded successfully. In my application user can change his profile photo. if user do the profile photo change its getting uploaded successfully , the problem is the browser will show previous photo only after the upload. after do the CTL + F5 then only the new image will start showing, Note : image upload using form post. i guess its related with caching but i don't have clue where can i change my code. please help me this out. Thanks.

+1  A: 

What property of your image object are you using as the src of your image? If you use user.image.url (assuming that you have a User model and that the Paperclip field's called image) then the URL to the image on S3 should have a number in the querystring that acts to stop any caching so that you see the updated image immediately. For example the URL for the image should change from

http://s3.amazonaws.com/bucket/images/5/original/pic.gif?1250184309

to

http://s3.amazonaws.com/bucket/images/5/original/pic.gif?1250184348

which should stop the browser caching the image.

Eifion
Thanks Eifion .... i got relief from your answer
palani