RichTextEditor has taken steps into file name management. A new and innovative capability is to allow advanced developers to build the file name filter. Once a filter has been set, only files whose names comply with the filter, will be displayed in the dialogs and will be enabled to be uploaded to the server. The other files are being "filtered out". To setup a filter, you need to be familiar with Regular Expression. Regular Expressions are advanced forms of wildcards and allow you to set filters precisely.

You can build your own file name filter using the following methods:

Building your own file name filter by editing security policy file

The security policy file (default.config, admin.config and guest.config) can be found in the richtexteditor/config folder. In security policy file you can find the security setting FilePattern. This setting defines the largest size of file that can be uploaded.

FilePattern setting can go directly under the root <rteconfig> node of security policy file. In this case, this setting will apply to all dialogs. It can also be placed into <category> node. In this case, it will only apply to the specified dialogs.

You can modify this settings to meet your own requirements.


<security name="FilePattern">^[a-zA-Z0-9\._\s-]+$</security><!-- This setting applies all dialogs ("Gallery","Image","Document","Video","Template"). -->
<category for="Video">
       <security name="FilePattern">^[a-zA-Z0-9\._\s-]+$</security><!-- This setting applies "Video" dialog only.-->
</category>
<category for="Gallery,Image">
       <security name="FilePattern">^[a-zA-Z0-9\._\s-]+$</security><!-- This setting applies "Gallery","Image" dialogs only.-->
</category>

Programmatically building your own file name filter

RichTextEditor provides a powerful method named Editor.SetSecurity that allows you programmatically manage the security settings.

Editor1.SetSecurity("*", "*", "FilePattern", "^[a-zA-Z0-9\._\s-]+$");  <!-- This setting applies all dialogs ("Gallery","Image","Document","Video","Template"). -->
Editor1.SetSecurity("Video", "*", "FilePattern", "^[a-zA-Z0-9\._\s-]+$");  <!-- This setting applies "Video" dialog only. -->
Editor1.SetSecurity("Gallery,Image", "*", "FilePattern", "^[a-zA-Z0-9\._\s-]+$");  <!-- This setting applies "Gallery","Image" dialogs only. -->

Send feedback about this topic to CuteSoft. © 2003 - 2014 CuteSoft Components Inc. All rights reserved.