hello everyone
please tell me some idea/code to replace existing image in a folder with new image having same name

i am creating a banner program
where i will give - option for customers to upload banner
i have done this part
now i want to write a code to avoid customer to upload same image again
i have put a confirm box for this-if der is a image already in folder-there will be a confirm box--(this code is js code for confirm box)
if customers clicks ok-
then image should get replaced with prvios one
and i will update table field date_modified for that image

thanks in adv,,,