(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.php …') |
(Introduction added, Default Resource Types moved to a template) |
||
Line 1: | Line 1: | ||
− | = | + | {{Ckfinder_2.x_Built-in_Resource_Types_Description|file=config.php}} |
− | + | <source lang="php"> | |
− | + | $config['ResourceType'][] = Array( | |
− | |||
− | |||
− | <source lang="php">$config['ResourceType'][] = Array( | ||
'name' => 'Files', // Single quotes not allowed | 'name' => 'Files', // Single quotes not allowed | ||
'url' => $baseUrl . 'files', | 'url' => $baseUrl . 'files', | ||
'directory' => $baseDir . 'files', | 'directory' => $baseDir . 'files', | ||
'maxSize' => 0, | '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', | + | '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' => ''); | 'deniedExtensions' => ''); | ||
Line 29: | Line 27: | ||
'deniedExtensions' => '');</source> | 'deniedExtensions' => '');</source> | ||
− | These resources will be enabled if this option: | + | These resources will be enabled by default if this option: |
− | + | <source lang="php">$config['DefaultResourceTypes'] = '';</source> | |
− | < | + | is left empty. You may specify which resource types you want to use by placing their names separated by a comma. |
− | |||
− | is left empty. You may specify | ||
== Resource Type Options == | == Resource Type Options == | ||
Line 50: | Line 46: | ||
'''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. | '''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. | ||
− | |||
− | |||
− |
Revision as of 16:57, 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 config.php
file as presented below with their default options:
$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 by default if this option:
$config['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 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.