How to copy a file without overwriting the destination file?

The script I made is.


$source_file = 'http://www.domain.tld/directory/img.png'; 
$dest_file = '/home/user/public_html/directory/directory/img.png'; 

copy($source_file, $dest_file);


I need that image to not be delete and reuploaded every time the script is running. I would either want it to be img1.png, img2.png, img3.png, etc. Or img(Date,Time).png, img(Date,Time).png, etc. Is this possible and if so, how do I do this?

Leave a Reply


Hire Me
Follow Me!
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.