This question already has an answer here:
i using this script to copying files to other folder when i clicked submit button
<?php
if (isset($_POST['upload']) && isset($_POST['datae'])) {
copy('../print/'.$_POST['datae'], '../Upload/'.$_POST['datae']);
echo "<meta http-equiv='refresh' content='1'>";
}
?>
and now im wondering what if i choose same filename and submitted twice or more. normally the filename i've already choose will copy and overwrite the same file that already stored in there.
but what i want is whenever i submitted twice or more the file that already in destination folder, it will not replace or overwrite but it will duplicating same file and just different in file name like
//example in my folder
img_7878.JPG
img_7878_copy1.JPG
img_7878_copy2.JPG
maybe i could get help from here.
</div>