Zawiszor
Zawiszor

Reputation: 538

ASP MVC 5 Profile Picture Refresh

I'm working on implementing change profile picture feature in ASP.NET MVC 5 application. I'm a beginner so please forgive me if I'm not specific enough.

The picture appears in the header and sidebar (partial views) as well as on the actual page. The picture is loaded from a specific location on the server: img/Users/userName.jpg. When I upload the new one using API controller the file is overwritten. Still the picture displayed on the page remains the same until I refresh the entire website.

Question: Is it possible to dynamically reload just the elements using the file, so the new picture is displayed automatically without calling window.location.reload(); ? Can you please explain how such thing could be achieved? Or at least point me in the right direction?

Thanks a lot. Please let me know if the question is understandable and if you require additional detail concerning the application.

Upvotes: 1

Views: 1094

Answers (1)

Pavan Teja
Pavan Teja

Reputation: 3202

Do Cache busting via params. append some query string with random values

<img src="/img.png?c=1111">

Upvotes: 2

Related Questions