Restricting template uploads using extension and MIME types |
RichTextEditor has the capability to allow or restrict uploading template files by extensions and types. You can filter the type of template 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 template files by extensions and types?
You can allow or restrict uploading template 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 template file extensions within RichTextEditor. You can modify this settings to meet your own requirements.
<category for="Template"> <security name="Extensions">*.txt,*.htm,*.html</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.
$rte->SetSecurity("Template", "default", "Extensions", "*.txt,*.htm,*.html");
Send feedback about this topic to CuteSoft. © 2003 - 2012 CuteSoft Components Inc. All rights reserved.