Ver originalfunction get_filename($file) { $name = pathinfo($file, PATHINFO_FILENAME); $ext = pathinfo($file, PATHINFO_EXTENSION); for ($i = 1; is_file($file); $i++) $file = "$name($i).$ext"; return $file;}