Hello, I have a page that updates a user's profile picture (replacing the old one) and redirects them back to their profile.
I use
header('Location: /control_panel.php?f=users');
to redirect them after the new image is saved.
Now, the problem is that the profile page often shows the old image before they refresh the page. I'm guessing this is because their profile picture always has the same name (their user_id.jpg). So, if you are user #152 your picture is 152.jpg.
Is there an easy way to make sure the image is always reloaded from its source and not from cache? Or, will I need to always change the file name to like user_id_random_number.jpg
If I have to have the file name as user_id_random_number, I don't know how to make my existing code work because I use:
if(file_exists(152.jpg)
and I wouldn't know how to find a file with a random number on the end.
Thanks!!!