Dynamic/Per User Upload Directory for FCKEditor (PHP)

The default installation of FCKEditor allows you to specify the upload directory for links, images, and flash files - but not on a per-instantiation basis. This works fine if your FCKEditor-powered application uses a single upload directory. But what if the users of your application need separate upload directories? Answer: a bit of hacking.

This hack has been tested only on version 2.3.1 (with PHP). In summary, modify the following files (in the FCKeditor/editor/filemanager directory) to accept an extra URL querystring:

  1. browser/default/browser.html
  2. browser/default/connectors/php/connector.php
  3. upload/php/upload.php

Then, when instantiating the FCKEditor, set the following properties:

  • $fckeditor->Config["LinkBrowserURL"]
  • $fckeditor->Config["ImageBrowserURL"]
  • $fckeditor->Config["FlashBrowserURL"]
  • $fckeditor->Config["LinkUploadURL"]
  • $fckeditor->Config["ImageUploadURL"]
  • $fckeditor->Config["FlashUploadURL"]

An alternative method would be to assign the relevant values to session variables in your application and modify just connector.php and upload.php to get the relevant values from these session variables. There are at least two drawbacks to this approach: first, the usage of session variables is forced down the throat of the implementation; and second, FCKEditor would be needlessly “glued” to your application.

28 September 2006 | FCKEditor | Comments

Comments:

  1.  
  2.  
  3.