I'm using this to upload a file and then rename it to a format like 4-5.jpg:
I would like to check for other files with the same name but with a differrent extension and delete them. How would i do that?
$tmp_name = $_FILES["pic"]["tmp_name"][$key];
$name = $_FILES["pic"]["name"][$key];
move_uploaded_file($tmp_name, "$archive_dir/$name");
$ext = substr_replace($_FILES["pic"]["name"][$key],"",0,strpos ($_FILES["pic"]["name"][$key],"."));
$new_fn[$key] = $item_no."-".$key.$ext;
rename("$archive_dir/$name", "$archive_dir/$new_fn[$key]");