Index: /FCKeditor/trunk/_whatsnew.html
===================================================================
--- /FCKeditor/trunk/_whatsnew.html	(revision 1625)
+++ /FCKeditor/trunk/_whatsnew.html	(revision 1626)
@@ -134,4 +134,6 @@
 		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1871">#1871</a>] PHP file browser: permissions 
 			applied with the chmod command are now configurable.</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1872">#1872</a>] Perl file browser: permissions 
+			applied with the chmod command are now configurable.</li>
 		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1873">#1873</a>] Python file browser: permissions 
 			applied with the chmod command are now configurable.</li>
Index: /FCKeditor/trunk/editor/filemanager/connectors/perl/commands.pl
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/perl/commands.pl	(revision 1625)
+++ /FCKeditor/trunk/editor/filemanager/connectors/perl/commands.pl	(revision 1626)
@@ -141,5 +141,14 @@
 			} else {
 				copy("$img_dir/$new_fname","$sFilePath");
-				chmod(0777,$sFilePath);
+				if (defined $CHMOD_ON_UPLOAD) {
+					if ($CHMOD_ON_UPLOAD) {
+						umask(000);
+						chmod($CHMOD_ON_UPLOAD,$sFilePath);
+					}
+				}
+				else {
+					umask(000);
+					chmod(0777,$sFilePath);
+				}
 				unlink("$img_dir/$new_fname");
 				last;
Index: /FCKeditor/trunk/editor/filemanager/connectors/perl/io.pl
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/perl/io.pl	(revision 1625)
+++ /FCKeditor/trunk/editor/filemanager/connectors/perl/io.pl	(revision 1626)
@@ -88,7 +88,17 @@
 	}
 	if(!(-e $folderPath)) {
-		umask(000);
-		mkdir("$folderPath",0777);
-		chmod(0777,"$folderPath");
+		if (defined $CHMOD_ON_FOLDER_CREATE && !$CHMOD_ON_FOLDER_CREATE) {
+			mkdir("$folderPath");
+		}
+		else {
+			umask(000);
+			if (defined $CHMOD_ON_FOLDER_CREATE) {
+				mkdir("$folderPath",$CHMOD_ON_FOLDER_CREATE);
+			}
+			else {
+				mkdir("$folderPath",0777);
+			}
+		}
+				
 		return(0);
 	} else {
Index: /FCKeditor/trunk/editor/filemanager/connectors/perl/upload_fck.pl
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/perl/upload_fck.pl	(revision 1625)
+++ /FCKeditor/trunk/editor/filemanager/connectors/perl/upload_fck.pl	(revision 1626)
@@ -28,4 +28,14 @@
 # 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 = 0755;
 
 # Filelock (1=use,0=not use)
@@ -125,7 +135,16 @@
 	my ($FORM) = @_;
 
-
-	mkdir($img_dir,0777);
-	chmod(0777,$img_dir);
+	if (defined $CHMOD_ON_FOLDER_CREATE && !$CHMOD_ON_FOLDER_CREATE) {
+		mkdir("$img_dir");
+	}
+	else {
+		umask(000);
+		if (defined $CHMOD_ON_FOLDER_CREATE) {
+			mkdir("$img_dir",$CHMOD_ON_FOLDER_CREATE);
+		}
+		else {
+			mkdir("$img_dir",0777);
+		}
+	} 
 
 	undef $img_data_exists;
