+ if(-d $new_physical)
+ {
+ return error("A directory called '$new_virtual' already exists. You cannot replace a directory!",upper_path($virtual));
+ }
+ elsif(not $data->{'cgi'}->param('confirmed'))
+ {
+ $dir = encode_entities($dir);
+
+ my $output = htmlhead("Replace existing file");
+ $output .= <<"END";
+<p>A file called '$new_virtual' already exists. Do you want to replace it?</p>
+
+<form action="$script" method="get">
+<input type="hidden" name="command" value="rename">
+<input type="hidden" name="file" value="$virtual">
+<input type="hidden" name="newfile" value="$new_virtual">
+<input type="hidden" name="confirmed" value="1">
+
+<p><input type="submit" value="Yes"></p>
+</form>
+
+<form action="$script" method="get">
+<input type="hidden" name="command" value="show">
+<input type="hidden" name="file" value="$dir">
+
+<p><input type="submit" value="No"></p>
+</form>
+END
+
+ $output .= htmlfoot;
+
+ return \$output;
+ }
+ }
+
+ if($data->{'uselist'}->in_use($data->{'new_virtual'}))
+ {
+ return error("The target file '$new_virtual' already exists and it is edited by someone else.",$dir);