Handling Built-in Resource Types

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

(Created page with '== Default resources == === Resources types === There are three built-in resources types in CKFinder: '''files''', '''images''' and '''flash'''. They appear in the config.asp f…')
 
(Article content moved to a template)
Line 1: Line 1:
== Default resources ==
+
{{Ckfinder_2.x_Built-in_Resource_Types_Description|file=configuration}}
 
+
<source lang="asp">Set ResourceTypes(0) = DefineResourceType( _
=== Resources types ===
 
 
 
There are three built-in resources types in CKFinder: '''files''', '''images''' and '''flash'''. They appear in the config.asp file as below:
 
<pre>Set ResourceTypes(0) = DefineResourceType( _
 
 
"Files", _  
 
"Files", _  
baseUrl &amp; "files", _  
+
baseUrl & "files", _  
baseDir &amp; "files", _  
+
baseDir & "files", _  
 
0, _  
 
0, _  
"7z,aiff,asf,avi,bmp,csv,doc,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xml,zip", _  
+
"7z,aiff,asf,avi,bmp,csv,doc,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pxd,qt,ram,rar,rm,
 +
rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xml,zip", _  
 
"" _
 
"" _
 
)
 
)
Line 15: Line 12:
 
Set ResourceTypes(1) = DefineResourceType( _
 
Set ResourceTypes(1) = DefineResourceType( _
 
"Images", _
 
"Images", _
baseUrl &amp; "images", _
+
baseUrl & "images", _
baseDir &amp; "images", _
+
baseDir & "images", _
 
0, _
 
0, _
 
"bmp,gif,jpeg,jpg,png", _
 
"bmp,gif,jpeg,jpg,png", _
Line 24: Line 21:
 
Set ResourceTypes(2) = DefineResourceType( _
 
Set ResourceTypes(2) = DefineResourceType( _
 
"Flash", _
 
"Flash", _
baseUrl &amp; "flash", _
+
baseUrl & "flash", _
baseDir &amp; "flash", _
+
baseDir & "flash", _
 
0, _
 
0, _
 
"swf,flv", _
 
"swf,flv", _
 
"" _
 
"" _
)</pre>  
+
)</source>  
The above syntaz reffers to functions written bellow in the following order:
+
The above syntax reffers to functions written below in the following order:
<pre>ResourceType.Add "name", name
+
<source lang="asp">ResourceType.Add "name", name
 
ResourceType.Add "url", url
 
ResourceType.Add "url", url
 
ResourceType.Add "directory", directory
 
ResourceType.Add "directory", directory
Line 37: Line 34:
 
ResourceType.Add "allowedExtensions", allowedExtensions
 
ResourceType.Add "allowedExtensions", allowedExtensions
 
ResourceType.Add "deniedExtensions", deniedExtensions
 
ResourceType.Add "deniedExtensions", deniedExtensions
</pre>  
+
</source>  
These resources will be enabled if this option:
+
<pre>CKFinder_Config.Add "DefaultResourceTypes", ""</pre>  
+
These resources will be enabled by default if this option:
is left empty. If not you may specify what resources types you want to use by placing their names separated by a comma.
+
<source lang="asp">CKFinder_Config.Add "DefaultResourceTypes", ""</source>  
 
+
is left empty. You may specify which resource types you want to use by placing their names separated by a comma.
=== Changing the default resources ===
 
 
 
Every resource type has several options which you may change.
 
 
 
'''url''' and '''directory''' - you can place any url adress and directory you wish but be sure that their specification will follow the rules reffering to '''url''' and '''directory''' in the [[CKFinder_2.x/Developers Guide/ASP.NET/Configuration/Quick Start|Quick Start]] section.
 
 
 
'''maxSize''' - is the maximum size of the uploaded image defined in bytes.You may also use shorthand notation. Available options are: G, M, K (case insensitive). Remember that: 1M equals 1048576 bytes (one Megabyte), 1K equals 1024 bytes (one Kilobyte), 1G equals one Gigabyte. Example: 'maxSize' =&gt; "8M",
 
 
 
 
 
 
 
You can use the following settings to list the file extensions that can be upload to the server:
 
 
 
* '''allowedExtensions''' - the extensions you wish CKFinder to use. If left empty, only DeniedExtensions is used to check uploads.
 
* '''deniedExtensions''' - the extensions you don't wish the CKFinder to use.
 
  
'''Important: It is recommended''' to always use the allowedExtensions setting, in favor of deniedExtensions. If you leave '''allowedExtensions''' empty and you define an extension in '''deniedExtensions''', for example "pdf", it will allow the upload of all the other files except the files with the "pdf" extension. However it isn't a good way to secure your server from unwanted uploads. The best way is to put all of the preferred extensions in '''allowedExtensions'''. That's the only way to effectively secure your server from hacker's attacks.
 
  
{{#CUSTOMTITLE:Built-in resource types}}
+
{{Ckfinder_2.x_Built-in_Resource_Types_Options|link=CKFinder_2.x/Developers_Guide/ASP/Configuration/Quick_Start}}

Revision as of 22:37, 30 March 2011

By deafult, CKFinder handles some types of resources. The following articles describes their default configuration as well as various customization options.

Default Resource Types

There are three built-in resources types in CKFinder: files, images, and Flash objects. They appear in the configuration file as presented below with their default options:

Set ResourceTypes(0) = DefineResourceType( _
"Files", _ 
baseUrl & "files", _ 
baseDir & "files", _ 
0, _ 
"7z,aiff,asf,avi,bmp,csv,doc,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pxd,qt,ram,rar,rm,
rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xml,zip", _ 
"" _
)

Set ResourceTypes(1) = DefineResourceType( _
"Images", _
baseUrl & "images", _
baseDir & "images", _
0, _
"bmp,gif,jpeg,jpg,png", _
"" _
)

Set ResourceTypes(2) = DefineResourceType( _
"Flash", _
baseUrl & "flash", _
baseDir & "flash", _
0, _
"swf,flv", _
"" _
)

The above syntax reffers to functions written below in the following order:

ResourceType.Add "name", name
ResourceType.Add "url", url
ResourceType.Add "directory", directory
ResourceType.Add "maxSize", maxSize
ResourceType.Add "allowedExtensions", allowedExtensions
ResourceType.Add "deniedExtensions", deniedExtensions

These resources will be enabled by default if this option:

CKFinder_Config.Add "DefaultResourceTypes", ""

is left empty. You may specify which resource types you want to use by placing their names separated by a comma.


Resource Type Options

For each resource type you may set several options to configure its behavior.

  • url and directory – define the base URL address and the server directory used to handle and publish the files for this resource type. They follow the same rules as defined in the Quick Start section for the baseUrl and baseDir settings.
  • maxSize – is the maximum size of the uploaded image defined in bytes. You may also use shorthand notation. Available options are: G, M, K (case insensitive). Remember that 1M equals 1048576 bytes (one Megabyte), 1K equals 1024 bytes (one Kilobyte), 1G equals 1 Gigabyte.
    Example
    {{{example}}}

You can use the following settings to list the file extensions that can be upload to the server:

  • allowedExtensions – the file extensions you wish to be allowed for upload with CKFinder. If left empty, only deniedExtensions is used to check uploads. The NO_EXT value can be used for enabling files without an extension.
  • deniedExtensions – the file extensions you do not wish to be uploaded with CKFinder. The NO_EXT value can be used for denying files without an extension.
important note
Important: It is recommended to always use the allowedExtensions setting, in favor of deniedExtensions. If you leave allowedExtensions empty and you add an extension to the deniedExtensions list, for example pdf, the settings will allow the upload of all other files except the files with the pdf extension. This approach is not a good way to secure your server from unwanted uploads. The best way is to put all of the preferred extensions in the allowedExtensions list. This is the only way to effectively secure your server from hacker attacks.