Line 2: | Line 2: | ||
For example, if want to create a resource type named MSdocs which will only accept files with the "doc", "ppt" and "xls" extensions, restricting the file size to 2 megabytes: | For example, if want to create a resource type named MSdocs which will only accept files with the "doc", "ppt" and "xls" extensions, restricting the file size to 2 megabytes: | ||
− | |||
<pre>type = ResourceType.Add( "MSdocs" ); | <pre>type = ResourceType.Add( "MSdocs" ); | ||
type.Url = BaseUrl + "docs/"; | type.Url = BaseUrl + "docs/"; | ||
type.Dir = BaseDir == "" ? "" : BaseDir + "docs/"; | type.Dir = BaseDir == "" ? "" : BaseDir + "docs/"; | ||
− | type.MaxSize = | + | type.MaxSize = 2097152; // 2MB in Bytes |
type.AllowedExtensions = new string[] { "doc", "ppt", "xls" }; | type.AllowedExtensions = new string[] { "doc", "ppt", "xls" }; | ||
type.DeniedExtensions = new string[] { };</pre> | type.DeniedExtensions = new string[] { };</pre> | ||
− | |||
The above options are described in the [[CKFinder/Developers Guide/ASP.NET/Configuration/Resource Types/Built-in|Built-in resource types]] section. | The above options are described in the [[CKFinder/Developers Guide/ASP.NET/Configuration/Resource Types/Built-in|Built-in resource types]] section. | ||
By default, CKFinder will use all the resources types including the new one you have just created. If you want to limit the CKFinder to use only your resource type you must place its name in the in the '''DefaultResourceTypes''' setting. For example: | By default, CKFinder will use all the resources types including the new one you have just created. If you want to limit the CKFinder to use only your resource type you must place its name in the in the '''DefaultResourceTypes''' setting. For example: | ||
− | |||
<pre>DefaultResourceTypes = "MSdocs"; | <pre>DefaultResourceTypes = "MSdocs"; | ||
</pre> | </pre> |
Revision as of 19:55, 12 January 2008
To create a new resource type you should append the following lines of code anywhere after the "ResourceType type;" line in the configuration file.
For example, if want to create a resource type named MSdocs which will only accept files with the "doc", "ppt" and "xls" extensions, restricting the file size to 2 megabytes:
type = ResourceType.Add( "MSdocs" ); type.Url = BaseUrl + "docs/"; type.Dir = BaseDir == "" ? "" : BaseDir + "docs/"; type.MaxSize = 2097152; // 2MB in Bytes type.AllowedExtensions = new string[] { "doc", "ppt", "xls" }; type.DeniedExtensions = new string[] { };
The above options are described in the Built-in resource types section.
By default, CKFinder will use all the resources types including the new one you have just created. If you want to limit the CKFinder to use only your resource type you must place its name in the in the DefaultResourceTypes setting. For example:
DefaultResourceTypes = "MSdocs";