]> git.p6c8.net - devedit.git/commitdiff
Added an option for overwriting files during file upload if they already exist
authorpcanterino <>
Sun, 29 Aug 2004 12:43:15 +0000 (12:43 +0000)
committerpcanterino <>
Sun, 29 Aug 2004 12:43:15 +0000 (12:43 +0000)
modules/Command.pm
templates/upload.htm

index a25f8f084113268d851fbc8d71abd6d9cee80493..46798eec4236b7f521959e39ff4185ddc554efe0 100644 (file)
@@ -6,7 +6,7 @@ package Command;
 # Execute Dev-Editor's commands
 #
 # Author:        Patrick Canterino <patshaping@gmx.net>
-# Last modified: 2004-08-02
+# Last modified: 2004-08-29
 #
 
 use strict;
@@ -476,7 +476,7 @@ sub exec_upload($$)
   my $file_phys = $physical."/".$filename;
   my $file_virt = $virtual."".$filename;
 
-  return error($config->{'errors'}->{'file_exists'},$virtual,{FILE => $file_virt}) if(-e $file_phys);
+  return error($config->{'errors'}->{'file_exists'},$virtual,{FILE => $file_virt}) if(-e $file_phys && not $cgi->param('overwrite'));
 
   my $ascii     = $cgi->param('ascii');
   my $handle    = $cgi->upload('uploaded_file');
index 2b9912889f98b0d3ffca00647aba1f56ac3049f4..cdc1f37992f4630dd15ce1a8a6867773c036b2e0 100644 (file)
@@ -30,6 +30,8 @@
 <p>Transfer mode (see below):<br>
 <input type="radio" name="ascii" value="1">ASCII <input type="radio" name="ascii" value="0" checked>Binary (default)</p>
 
+<p><input type="checkbox" name="overwrite">Overwrite file if it already exists</p>
+
 <p><input type="submit" value="Upload file!"></p>
 </form>
 

patrick-canterino.de