带有KCFinder UserFilesPath的FCKEditor

On my web application I use FCKEditor to edit news. The FCKEditor is using KCFinder for browsing the server for files or images.

In the config.php (FCKEditor->connector->browser) I configured the UserFilesPath and the UserFilesAbsolutePath. The UserFilesPath contains the full http://www.domain.tld/images/files/ path and the UserFilesAbsolutePath contains the same path but with document root instead of the tld.

But when I go to FCKEditor window and try to add a link to a text, first the dialog opens, than I click on Browser Server and when I double click on a file I get back to the dialog box with a path like this: /images/files/xyz.pdf (e.g.).

Actually I would need the path like this: http://www.domain.tld/images/files/xyz.pdf

Please review the scenario and provide some solution.

StartupPath is a property of the CKFinder object. See documentation for more information.

There is a working example included in the CKFinder package that shows how StartupPath can be used: "_samples/js/popups.html".

StartupPath can be used in a similar way when CKFinder is attached to FCKeditor with the SetupFCKeditor method.

In javascript you can use also the following syntax:

CKFinder.SetupFCKeditor( oFCKeditor, { BasePath : '/ckfinder/', StartupPath :
 'Images:/path/to/directory/' } ) ;

So, for a fully working example of setting StartupPath when CKFinder is integrated with FCKeditor, just follow these steps:

  • open _samples/js/fckeditor.html
  • comment out this line (add double slash - "//"): //CKFinder.SetupFCKeditor( oFCKeditor, '../../' );
  • add the following code one line below: CKFinder.SetupFCKeditor( oFCKeditor, { BasePath : '../../', StartupPath : 'Images:/directory/' } ) ; where "Images:/directory/" is a valid startup path and it should work.