PDA

View Full Version : Refresh an image


lpeek
06-22-2007, 10:41 PM
I have a piece of code to upload an image to a folder... the file overwrites a file that is already there but when i load the page on which the file is uploaded and display the image i have refresh the page before the NEW image is seen.

Does anyone know of some code that will refresh JUST the image? whether its something i should to do in PHP or if i have to use some basic HTML or Javascript?

Mwnciau
06-22-2007, 11:18 PM
Lookup AJAX, it combines javascript and XML to get pages update info.

or you could just do:


<script>
setInterval("document.getElementById('image').src='images/src.jpg'", 1000);
</script>


at the bottom of your page, and set the image's id to image and change the images/src.jpg

aedrin
06-22-2007, 11:58 PM
I'm not sure just setting the image's src property will force the browser to check for an update.

Mwnciau
06-23-2007, 12:30 AM
possibly changing it to something else and back

_Aerospace_Eng_
06-23-2007, 01:10 AM
If you attach a random number to the image src then yes the browser will try to update it.