The image in PHP is not updated

0

I have an application where I can upload user profile photos; the script works perfect, the problem is generated when I go to change the photo and update it for another continues appearing the previous one, even though the one that had already been deleted from the directory.

Note: After a while the photo that I have updated appears.

    
asked by Giovanny Garcia Holguin 23.08.2017 в 05:09
source

2 answers

0

Is the cache, to the url add at the end a variable with a number this now that whenever I reload the script. Example:

<script src='http://www.pepepe.com/asdasd/index.js?update=<?php echo rand(); ?>'></script>
    
answered by 23.08.2017 / 06:15
source
0

If you do Control + Shift + R you will see the image refreshed.

Browsers cache the images based on a route, if you want the image to change every time, you must change the name.

profile_01.jpg profile_02.jpg

(The name of the image that is saved on the server, not the one you upload)

P.D: The answer is ambiguous because the question is also: (

    
answered by 23.08.2017 в 11:45