Index: editor/filemanager/connectors/perl/commands.pl
===================================================================
--- editor/filemanager/connectors/perl/commands.pl	(revision 1583)
+++ editor/filemanager/connectors/perl/commands.pl	(working copy)
@@ -140,7 +140,9 @@
 				$sErrorNumber = '201';
 			} else {
 				copy("$img_dir/$new_fname","$sFilePath");
-				chmod(0777,$sFilePath);
+				if ($CHMOD_ON_UPLOAD) {
+					chmod($CHMOD_ON_UPLOAD,$sFilePath);
+				}
 				unlink("$img_dir/$new_fname");
 				last;
 			}
Index: editor/filemanager/connectors/perl/io.pl
===================================================================
--- editor/filemanager/connectors/perl/io.pl	(revision 1583)
+++ editor/filemanager/connectors/perl/io.pl	(working copy)
@@ -89,7 +89,9 @@
 	if(!(-e $folderPath)) {
 		umask(000);
 		mkdir("$folderPath",0777);
-		chmod(0777,"$folderPath");
+		if ($CHMOD_ON_FOLDER_CREATE) {
+			chmod($CHMOD_ON_FOLDER_CREATE,"$folderPath");
+		}
 		return(0);
 	} else {
 		return(1);
Index: editor/filemanager/connectors/perl/upload_fck.pl
===================================================================
--- editor/filemanager/connectors/perl/upload_fck.pl	(revision 1583)
+++ editor/filemanager/connectors/perl/upload_fck.pl	(working copy)
@@ -28,6 +28,16 @@
 # File size max(unit KB)
 $MAX_CONTENT_SIZE =  30000;
 
+# After file is uploaded, sometimes it is required to change its permissions
+# so that it was possible to access it at the later time.
+# If possible, it is recommended to set more restrictive permissions, like 0755.
+# Set to 0 to disable this feature.
+$CHMOD_ON_UPLOAD = 0777;
+
+# See comments above.
+# Used when creating folders that does not exist.
+$CHMOD_ON_FOLDER_CREATE = 0777;
+
 # Filelock (1=use,0=not use)
 $PM{'flock'}		= '1';
 
@@ -126,7 +136,9 @@
 
 
 	mkdir($img_dir,0777);
-	chmod(0777,$img_dir);
+	if ($CHMOD_ON_FOLDER_CREATE) {
+		chmod($CHMOD_ON_FOLDER_CREATE,$img_dir);
+	}
 
 	undef $img_data_exists;
 	undef @NEWFNAMES;
