Quick Start"

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 '== The CheckAuthentication() function<br> == By default, CKFinder will not work due to authentication restrictions. You must first be sure that you have configured it properly, …')
 
(Code formatting added)
Line 8: Line 8:
  
 
The following is a sample implementation for it:
 
The following is a sample implementation for it:
<pre>public override bool CheckAuthentication()
+
<source lang="asp">public override bool CheckAuthentication()
 
{
 
{
 
     if ( Session[ "IsAuthenticated" ] &amp;&amp; (bool)Session[ "IsAuthenticated" ] == true )
 
     if ( Session[ "IsAuthenticated" ] &amp;&amp; (bool)Session[ "IsAuthenticated" ] == true )
Line 17: Line 17:
 
     return false;
 
     return false;
 
}
 
}
</pre>
+
</source>
  
 
== License ==
 
== License ==
  
 
The license information for CKFinder must be pasted inside the LicenseName and LicenseKey variables:
 
The license information for CKFinder must be pasted inside the LicenseName and LicenseKey variables:
<pre>LicenseName = "put your license name here";
+
<source lang="asp">LicenseName = "put your license name here";
LicenseKey = "put your license key here";</pre>  
+
LicenseKey = "put your license key here";</source>  
 
If these fields are blank or an invalid license key information is set, CKFinder will still be fully functional but it will be ruining in demo mode.
 
If these fields are blank or an invalid license key information is set, CKFinder will still be fully functional but it will be ruining in demo mode.
  
Line 29: Line 29:
  
 
The&nbsp;'''BaseUrl''' setting is the base path used to build the final URL for the resources handled in CKFinder. For example:
 
The&nbsp;'''BaseUrl''' setting is the base path used to build the final URL for the resources handled in CKFinder. For example:
<pre>BaseUrl = "/ckfinder/userfiles/";</pre>  
+
<source lang="asp">BaseUrl = "/ckfinder/userfiles/";</source>  
 
Notice that the trailing slash is required.
 
Notice that the trailing slash is required.
  
Line 35: Line 35:
  
 
You may point it to a directory directly. For example:
 
You may point it to a directory directly. For example:
<pre>BaseDir = "C:/SiteDir/CKFinder/userfiles/";</pre>  
+
<source lang="asp">BaseDir = "C:/SiteDir/CKFinder/userfiles/";</source>  
 
By leaving BaseDir empty, CKFinder will automatically attempt to resolve the path, based on '''BaseUrl''' (like Server.MapPath). For example:
 
By leaving BaseDir empty, CKFinder will automatically attempt to resolve the path, based on '''BaseUrl''' (like Server.MapPath). For example:
<pre>BaseDir = "";</pre>
+
<source lang="asp">BaseDir = "";</source>
  
 
=== Full URLs<br> ===
 
=== Full URLs<br> ===
  
 
CKFinder is able to resolve the BaseUrl path only when setting it to an absolute URL path, starting from the document root. For example:
 
CKFinder is able to resolve the BaseUrl path only when setting it to an absolute URL path, starting from the document root. For example:
<pre>BaseUrl = "/userfiles/";
+
<source lang="asp">BaseUrl = "/userfiles/";
 
BaseDir = "";
 
BaseDir = "";
</pre>  
+
</source>  
 
If you need CKFinder to return full URL address for the resources, the you are explicetelly required to set the BaseDir setting. For example:<br>
 
If you need CKFinder to return full URL address for the resources, the you are explicetelly required to set the BaseDir setting. For example:<br>
<pre>// THIS IS WRONG:
+
<source lang="asp">// THIS IS WRONG:
 
BaseUrl = "http://example.com/ckfinder/files/";
 
BaseUrl = "http://example.com/ckfinder/files/";
 
BaseDir = "";
 
BaseDir = "";
Line 53: Line 53:
 
BaseUrl = "http://example.com/ckfinder/files/";
 
BaseUrl = "http://example.com/ckfinder/files/";
 
BaseDir = "C:/InetPub/MySite/ckfinder/files/";
 
BaseDir = "C:/InetPub/MySite/ckfinder/files/";
</pre>
+
</source>

Revision as of 12:51, 31 March 2011

The CheckAuthentication() function

By default, CKFinder will not work due to authentication restrictions. You must first be sure that you have configured it properly, and then enable it.

Once you have completely configured CKFinder, you are ready to enable it for use. The CheckAuthentication() function is used for that. In this function, you must implement the code that ensures that the requests are coming from an authenticated user. This is usually done by assigning a session variable when the user logs on your system.

Return "true" if the user is properly authenticated. We strongly recommend you to NOT simply return "true" from this function without implementing authentication checks. Anonymous users would be able to use CKFinder, including uploading and deleting files from your server.

The following is a sample implementation for it:

public override bool CheckAuthentication()
{
    if ( Session[ "IsAuthenticated" ] &amp;&amp; (bool)Session[ "IsAuthenticated" ] == true )
    {
        return true;
    }

    return false;
}

License

The license information for CKFinder must be pasted inside the LicenseName and LicenseKey variables:

LicenseName = "put your license name here";
LicenseKey = "put your license key here";

If these fields are blank or an invalid license key information is set, CKFinder will still be fully functional but it will be ruining in demo mode.

Base URL and Directory

The BaseUrl setting is the base path used to build the final URL for the resources handled in CKFinder. For example:

BaseUrl = "/ckfinder/userfiles/";

Notice that the trailing slash is required.

The BaseDir is the path to the local directory (in the server) which points to the above URL. This is the path used by CKFinder to handle the files in the server. Full write permissions must be granted to this directory.

You may point it to a directory directly. For example:

BaseDir = "C:/SiteDir/CKFinder/userfiles/";

By leaving BaseDir empty, CKFinder will automatically attempt to resolve the path, based on BaseUrl (like Server.MapPath). For example:

BaseDir = "";

Full URLs

CKFinder is able to resolve the BaseUrl path only when setting it to an absolute URL path, starting from the document root. For example:

BaseUrl = "/userfiles/";
BaseDir = "";

If you need CKFinder to return full URL address for the resources, the you are explicetelly required to set the BaseDir setting. For example:

// THIS IS WRONG:
BaseUrl = "http://example.com/ckfinder/files/";
BaseDir = "";

// THIS IS GOOD:
BaseUrl = "http://example.com/ckfinder/files/";
BaseDir = "C:/InetPub/MySite/ckfinder/files/";