How to show the last uploaded image when refresh page in PHP

See here for the original answer.

This can be solved by adding random parameters to the image src, as shown here. For example, turn this:

<img src="image.png" />

Into this:

<img src="image.jpg?1222259157.415">

In the second src, the numbers after the question mark are the current timestamp. This is demonstrated in this answer, which sets the timestamp in JavaScript and appends it to the src using Date.now().


Tags

  1. php (Private)
  2. image (Private)
  3. stack-overflow (Private)
  4. answer (Private)