Built-in"

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.

(Resource Type Options)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Default resources ==
+
'''Resource Types''' are ways to organize the files in your server by type, or to group them under different features. For example, you may have a resource type called Images, where only image files can be uploaded.
  
=== Resources types ===
+
== Standard Resource Types ==
  
There are three built-in resources types in CKFinder: '''files''', '''images''' and '''flash'''. They appear in the config.php file as below:
+
There are three built-in resources types in CKFinder: '''Files''', '''Images''' and '''Flash'''. They appear in the configuration file as below:
<pre>&lt;ResourceType
+
<pre>ResourceType type;
name = "Files"
 
url = "%BASEURL%files"
 
directory = "%BASEDIR%files"
 
maxSize = ""
 
allowedExtensions = ""
 
deniedExtensions = "php,php3,php5,phtml,asp,aspx,ascx,jsp,cfm,cfc,pl,bat,exe,dll,reg,cgi"
 
/&gt;
 
  
&lt;ResourceType
+
type = ResourceType.Add( "Files" );
name = "Images"
+
type.Url = BaseUrl + "files/";
url = "%BASEURL%images"
+
type.Dir = BaseDir == ""&nbsp;? ""&nbsp;: BaseDir + "files/";
directory = "%BASEDIR%images"
+
type.MaxSize = 0;
maxSize = ""
+
type.AllowedExtensions = new string[] { "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", "zip" };
allowedExtensions = "jpg,gif,jpeg,png"
+
type.DeniedExtensions = new string[] { };
deniedExtensions = ""
 
/&gt;
 
  
&lt;ResourceType
+
type = ResourceType.Add( "Images" );
name = "Flash"
+
type.Url = BaseUrl + "images/";
url = "%BASEURL%flash"
+
type.Dir = BaseDir == ""&nbsp;? ""&nbsp;: BaseDir + "images/";
directory = "%BASEDIR%flash"
+
type.MaxSize = 0;
maxSize = ""
+
type.AllowedExtensions = new string[] { "bmp", "gif", "jpeg", "jpg", "png" };
allowedExtensions = "swf,fla"
+
type.DeniedExtensions = new string[] { };
deniedExtensions = ""
 
/&gt;</pre>
 
These resources will be enabled if this option:
 
<pre>&lt;ResourceTypes
 
default = ""
 
&gt;</pre>
 
is left empty. If not you may specify what resources types you want to use by placing their names separated by a comma.
 
  
=== Changing the default resources ===
+
type = ResourceType.Add( "Flash" );
 +
type.Url = BaseUrl + "flash/";
 +
type.Dir = BaseDir == ""&nbsp;? ""&nbsp;: BaseDir + "flash/";
 +
type.MaxSize = 0;
 +
type.AllowedExtensions = new string[] { "swf", "flv" };
 +
type.DeniedExtensions = new string[] { };
 +
</pre>
  
Every resource type has several options which you may change.
+
== DefaultResourceTypes<br> ==
  
'''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 '''baseUrl''' and '''baseDir''' in the [[CKFinder/Developers Guide/ASP.NET/Configuration/Quick Start|Quick Start]] section.
+
When opening CKFinder, you may specify which Resource Type to make visible by appending '''?type=&lt;TypeName&gt;''' to the CKFinder URL. If instead the type is not passed in the URL, the DefaultResourceTypes setting will be used to identify which Resource Types to load. If blank, all Resource Types will be displayed. For example:
  
'''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",
+
<pre>// Show all Resource Types:
 +
DefaultResourceTypes = "";
  
'''allowedExtensions''' - here you place all the extensions you wish the CKFinder to use, seperated by a comma. .
+
// Show the "Images" and "Files" Resource Types only (separated by comma):
 +
DefaultResourceTypes = "Images,Files";
 +
</pre>
 +
 
 +
== Resource Type Options ==
 +
 
 +
For each resource type you may set several options to precisely configure its behavior.
 +
 
 +
=== Url and Dir ===
 +
 
 +
Define the base URL address and the server directory to use to handle and publish the files for this Resource Type. They follow the same rules as defined in the [[CKFinder_1.x/Developers Guide/ASP.NET/Configuration/Quick Start#Base URL and Directory|Quick Start]] section for the '''BaseUrl''' and '''BaseDir''' settings.
 +
 
 +
=== MaxSize ===
 +
 
 +
It's the maximum size allowed for uploaded file defined in Bytes.
  
'''deniedExtensions''' - here you place all the extensions you don't wish the CKFinder to use, seperated by a comma.
+
=== Allowed'''Extensions and DeniedExtensions''' ===
  
<br>'''Important''': if you leave '''allowedExtensions''' empty and you will put something in '''deniedExtensions''' e.g.pdf it will allow the upload of all the files exept the pdf. However it isn't a good way to secure your server from unwanted uploads. The best way is to put all of the prefered extensions in '''allowedExtensions''' and put the unwanted ones in the '''deniedExtensions'''. Only in this way you will secure your server from junk.
+
You can use this settings to list the file extensions that can be upload to the server.
  
== FCKeditor issues ==
+
* '''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.
  
CKFinder may be intergrated with FCKeditor. If so when looking througout the files the editor will use the resources types specifies in the config.php file of the CKFinder. To instead configure FCKeditor manually to use CKFinder, just edit the fckconfig.js file in the FCKeditor directory and modify the following settings:
+
'''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.
<pre>FCKConfig.LinkBrowserURL = '/ckfinder/ckfinder.html'&nbsp;;
 
FCKConfig.ImageBrowserURL = '/ckfinder/ckfinder.html?type=Images'&nbsp;;
 
FCKConfig.FlashBrowserURL = '/ckfinder/ckfinder.html?type=Flash'&nbsp;;
 
</pre>
 
Just change "/ckfinder/" in the above URLs if you have CKFinder installed in a different place. {{DISPLAYTITLE:Built-in resource types}}
 

Latest revision as of 09:32, 28 May 2010

Resource Types are ways to organize the files in your server by type, or to group them under different features. For example, you may have a resource type called Images, where only image files can be uploaded.

Standard Resource Types

There are three built-in resources types in CKFinder: Files, Images and Flash. They appear in the configuration file as below:

ResourceType type;

type = ResourceType.Add( "Files" );
type.Url = BaseUrl + "files/";
type.Dir = BaseDir == "" ? "" : BaseDir + "files/";
type.MaxSize = 0;
type.AllowedExtensions = new string[] { "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", "zip" };
type.DeniedExtensions = new string[] { };

type = ResourceType.Add( "Images" );
type.Url = BaseUrl + "images/";
type.Dir = BaseDir == "" ? "" : BaseDir + "images/";
type.MaxSize = 0;
type.AllowedExtensions = new string[] { "bmp", "gif", "jpeg", "jpg", "png" };
type.DeniedExtensions = new string[] { };

type = ResourceType.Add( "Flash" );
type.Url = BaseUrl + "flash/";
type.Dir = BaseDir == "" ? "" : BaseDir + "flash/";
type.MaxSize = 0;
type.AllowedExtensions = new string[] { "swf", "flv" };
type.DeniedExtensions = new string[] { };

DefaultResourceTypes

When opening CKFinder, you may specify which Resource Type to make visible by appending ?type=<TypeName> to the CKFinder URL. If instead the type is not passed in the URL, the DefaultResourceTypes setting will be used to identify which Resource Types to load. If blank, all Resource Types will be displayed. For example:

// Show all Resource Types:
DefaultResourceTypes = "";

// Show the "Images" and "Files" Resource Types only (separated by comma):
DefaultResourceTypes = "Images,Files";

Resource Type Options

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

Url and Dir

Define the base URL address and the server directory to use 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

It's the maximum size allowed for uploaded file defined in Bytes.

AllowedExtensions and DeniedExtensions

You can use this 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.

This page was last edited on 28 May 2010, at 09:32.