RichTextEditor has the capability to allow or restrict uploading document files by extensions and types. You can filter the type of document 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 document files by extensions and types?
You can allow or restrict uploading document 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 document file extensions within RichTextEditor. You can modify this settings to meet your own requirements.
<category for="Document"> <security name="Extensions">*.txt,*.doc,*.pdf,*.zip,*.rar,*.htm,*.xls,*.html,*.rtf</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("Document", "default", "Extensions", "*.txt,*.doc,*.pdf");
Send feedback about this topic to CuteSoft. © 2003 - 2018 CuteSoft Components Inc. All rights reserved.