Difference between revisions of "Template:CKFinder 2.x Sample Plugin Introduction"

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.

Line 6: Line 6:
  
 
The FileSize plugin should provide a new command named "FileSize", in other words, calling:
 
The FileSize plugin should provide a new command named "FileSize", in other words, calling:
<pre>
+
<source>
 
/ckfinder/core/connector/{{{ext}}}/connector.{{{ext}}}?command=FileSize&type=Files&currentFolder=%2F&fileName=foobar.jpg
 
/ckfinder/core/connector/{{{ext}}}/connector.{{{ext}}}?command=FileSize&type=Files&currentFolder=%2F&fileName=foobar.jpg
</pre>
+
</source>
 
(assuming that foobar.jpg exists)
 
(assuming that foobar.jpg exists)
 
should return a valid XML response:
 
should return a valid XML response:

Revision as of 10:32, 25 May 2010

Sample plugin: FileSize (adding new server side command - complete example)

Introduction

Probably the best way to learn new things is to write a code, so let's write a plugin that adds a new server side command to the connector. We'll create a command that returns a size of a given file.

If you're unfamiliar with CKFinder architecture, please take a look at Server Side Integration documentation. Alternatively, just bear in mind that CKFinder is an AJAX application and that the connection between the user interface running in a browser and the server connector is simply made of AJAX calls to the connector. Check AJAX calls in Firebug to better understand CKFinder.

The FileSize plugin should provide a new command named "FileSize", in other words, calling:

/ckfinder/core/connector/{{{ext}}}/connector.{{{ext}}}?command=FileSize&type=Files&currentFolder=%2F&fileName=foobar.jpg

(assuming that foobar.jpg exists) should return a valid XML response:

<Connector resourceType="Files">
<Error number="0"/>
<CurrentFolder path="/" url="/ckfinder/userfiles/files/" acl="255"/>
<FileSize size="5647"/>
</Connector>