RichTextEditor has the capability to allow or restrict uploading image files by extensions and types. You can filter the type of image files you want to upload so only specified file types are allowed.
RichTextEditor also automatically detect the MIME type of the files you upload, and rejects the file if the file-extension does not match the mime type ("The file is corrupt or has an incorrect extension"). If you want to upload uncommon types of files, you may need to add the appropriate information into the security policy files:
How to allow or restrict uploading image files by extensions and types?
You can allow or restrict uploading image files by extensions and types using the following methods:
Edit 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 following code which defines allowed image file extensions within RichTextEditor. You can modify this settings to meet your own requirements.
<category for="Gallery,Image"> <security name="Extensions">*.jpg,*.jpeg,*.gif,*.png</security> <security name="MimeTypes">image/*</security> </category>
Programmatically validate file type and file extension when uploading
RichTextEditor provides a powerful method named Editor.SetSecurity that allows you programmatically manage the security settings.
Editor1.SetSecurity("Gallery,Image", "default", "Extensions", "*.gif,*.png"); Editor1.SetSecurity("Gallery,Image", "default", "MimeTypes", "image/*");
Send feedback about this topic to CuteSoft. © 2003 - 2014 CuteSoft Components Inc. All rights reserved.