]> git.p6c8.net - devedit.git/blobdiff - modules/Command.pm
Added an option for overwriting files during file upload if they already exist
[devedit.git] / modules / Command.pm
index 8e4716365ea22c0c082755da4f0fc7bb8b205db5..46798eec4236b7f521959e39ff4185ddc554efe0 100644 (file)
@@ -6,7 +6,7 @@ package Command;
 # Execute Dev-Editor's commands
 #
 # Author:        Patrick Canterino <patshaping@gmx.net>
-# Last modified: 2004-07-28
+# 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');
@@ -772,7 +772,7 @@ sub exec_chprop($$)
    }
    else
    {
-    my @stat     = lstat($physical);
+    my @stat     = stat($physical);
 
     my $mode     = $stat[2];
     my $mode_oct = substr(sprintf("%04o",$mode),-4);

patrick-canterino.de