Ujjwal Prajapati
Ujjwal Prajapati

Reputation: 286

How to solve the page refresh issue in Yii?

I have a page where we can change our profile picture just like in twitter. But when I change the profile picture, the image is not refreshed. I have used the same controller to change and render the page. I need to hit F5 button to see the image has been changed.

For Instance: the page is setting/profile, when we save the image the same controller/action is called and the same view is rendered but the image does not refresh.

How do I get this thing work? I have tried javascript, tried redirect nothing seem to work. I can only see it work while hitting F5 button manually.

Any suggestion or solution is greatly appreciated.

Thanks,

Upvotes: 0

Views: 1723

Answers (1)

Stephen305
Stephen305

Reputation: 1097

Here is an example you could use in your view.

echo CHtml::image(Yii::app()->request->baseUrl."/images/profile_pic$user_id.png?_=".time(), 'Profile Pic');

Upvotes: 3

Related Questions