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.

(Resource Type Options)
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
== Default resources ==
 
== Default resources ==
  
=== Resources types ===
+
=== Resources 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 config.php file as below:
<pre>$config['ResourceType'][] = Array(
+
'name' =&gt; 'Files', // Single quotes not allowed
+
<source lang="php">$config['ResourceType'][] = Array(
'url' =&gt; $baseUrl . 'files',
+
'name' => 'Files', // Single quotes not allowed
'directory' =&gt; $baseDir . 'files',
+
'url' => $baseUrl . 'files',
'maxSize' =&gt; 0,
+
'directory' => $baseDir . 'files',
'allowedExtensions' =&gt; '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',
+
'maxSize' => 0,
'deniedExtensions' =&gt; '');
+
'allowedExtensions' => '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',
 +
'deniedExtensions' => '');
  
 
$config['ResourceType'][] = Array(
 
$config['ResourceType'][] = Array(
'name' =&gt; 'Images',
+
'name' => 'Images',
'url' =&gt; $baseUrl . 'images',
+
'url' => $baseUrl . 'images',
'directory' =&gt; $baseDir . 'images',
+
'directory' => $baseDir . 'images',
'maxSize' =&gt; 0,
+
'maxSize' => 0,
'allowedExtensions' =&gt; 'bmp,gif,jpeg,jpg,png',
+
'allowedExtensions' => 'bmp,gif,jpeg,jpg,png',
'deniedExtensions' =&gt; '');
+
'deniedExtensions' => '');
  
 
$config['ResourceType'][] = Array(
 
$config['ResourceType'][] = Array(
'name' =&gt; 'Flash',
+
'name' => 'Flash',
'url' =&gt; $baseUrl . 'flash',
+
'url' => $baseUrl . 'flash',
'directory' =&gt; $baseDir . 'flash',
+
'directory' => $baseDir . 'flash',
'maxSize' =&gt; 0,
+
'maxSize' => 0,
'allowedExtensions' =&gt; 'swf,flv',
+
'allowedExtensions' => 'swf,flv',
'deniedExtensions' =&gt; '');</pre>
+
'deniedExtensions' => '');</source>  
 +
 
These resources will be enabled if this option:
 
These resources will be enabled if this option:
<pre>$config['DefaultResourceTypes'] = '';</pre>
+
is left empty. If not you may specify what resources types you want to use by placing their names separated by a comma.
+
<pre>$config['DefaultResourceTypes'] = '';</pre>  
 +
 +
is left empty. You may specify what resources types you want to use by placing their names separated by a comma.
  
=== Changing the default resources ===
+
== Resource Type Options ==
  
Every resource type has several options which you may change.
+
For each resource type you may set several options to precisely configure its behavior.
 +
 +
'''url''' and '''directory''' - 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/PHP/Configuration/Quick Start|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 one Gigabyte. Example: 'maxSize' => "8M",
 +
  
'''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/Users Guide/CKFinder Configuration/PHP/Quick Start|Quick Start]] section.
+
You can use the following settings to list the file extensions that can be upload to the server:
  
'''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",
+
* '''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.
  
'''allowedExtensions''' - here you place all the extensions you wish the CKFinder to use, seperated by a comma. .
+
'''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.
  
'''deniedExtensions''' - here you place all the extensions you don't wish the CKFinder to use, seperated by a comma.
 
  
<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.
+
{{#CUSTOMTITLE:Built-in resource types}}
 
 
== FCKeditor issues ==
 
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:
 
<pre>
 
FCKConfig.LinkBrowserURL = '/ckfinder/ckfinder.html' ;
 
FCKConfig.ImageBrowserURL = '/ckfinder/ckfinder.html?type=Images' ;
 
FCKConfig.FlashBrowserURL = '/ckfinder/ckfinder.html?type=Flash' ;
 
</pre>
 
 
 
Just change "/ckfinder/" in the above URLs if you have CKFinder installed in a different place.
 

Latest revision as of 09:01, 28 May 2010

Default resources

Resources types

There are three built-in resources types in CKFinder: files, images and flash. They appear in the config.php file as below:

$config['ResourceType'][] = Array(
'name' => 'Files', // Single quotes not allowed
'url' => $baseUrl . 'files',
'directory' => $baseDir . 'files',
'maxSize' => 0,
'allowedExtensions' => '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',
'deniedExtensions' => '');

$config['ResourceType'][] = Array(
'name' => 'Images',
'url' => $baseUrl . 'images',
'directory' => $baseDir . 'images',
'maxSize' => 0,
'allowedExtensions' => 'bmp,gif,jpeg,jpg,png',
'deniedExtensions' => '');

$config['ResourceType'][] = Array(
'name' => 'Flash',
'url' => $baseUrl . 'flash',
'directory' => $baseDir . 'flash',
'maxSize' => 0,
'allowedExtensions' => 'swf,flv',
'deniedExtensions' => '');

These resources will be enabled if this option:

$config['DefaultResourceTypes'] = '';

is left empty. You may specify what resources 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 precisely configure its behavior.

url and directory - 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 - 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' => "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.


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