0

I wrote a small framework with URI structure of lang/domain/controller/method/id an now that I want to use CKFinder integrated with CKEditor I cannot upload and browse server because of address structure? What should I do? To browse the server it uses:

http://localhost/public/admin/style1/plugins/ckfinder/ckfinder.html?CKEditor=abstraction&CKEditorFuncNum=1&langCode=fa

Now I have changed upload and browse address by these:

 CKEDITOR.replace('article',
    {
        filebrowserBrowseUrl : '/browser/browse.php',
        filebrowserUploadUrl : '/uploader/upload.php'
    });

it shows the images but when I choose them it does not bring it to page and it uploads the file to my image folder but cannot add them or even preview them in body or upload dialogbox. How can I use ckeditor with clear URL?

Anna Tomanek
  • 2,219
  • 16
  • 23
hamid
  • 31
  • 7

1 Answers1

4

CKFinder with custom paths

If you are doing URL rewrite and you expect CKFinder to return URLs with custom paths you can do the following:

You can configure how CKFinder sends URLs to CKEditor in CKFinder's config.php file in the backends section:

$config['backends'][] = array(
    'name'         => 'default',
    'adapter'      => 'local',
    'baseUrl'      => 'http://base/url/ckfinder/will/give/to/ckeditor',
    'root'         => '/path/to/files/on/disk',
    'chmodFiles'   => 0777,
    'chmodFolders' => 0755,
    'filesystemEncoding' => 'UTF-8'
);

The file path is appended to all URLs and this behavior can't be changed by configuration.

E.g. for /path/to/files/on/disk/images/picture.png the returned URL is http://base/url/ckfinder/will/give/to/ckeditor/images/picture.png

Alternatively you may add 'useProxyCommand' => true to the backend configuration.

This will change all returned URLs to the form of http://localhost/core/connector/php/connector.php?command=Proxy&lang=en&type=Files&currentFolder=%2F&hash=9fd5e9f22b8dea6a&fileName=picture.png, where http://localhost/core/connector/php/connector.php is the URL that was used to make the request to get the file's URL.

Custom integration with a file manager

If you are implementing your own integration with a file manager check your response from /uploader/upload.php. CKEditor expects something like:

<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction(1, 'http://file/url', 'message');</script>`

You can find more information in the CKEditor's documentation

kfazi
  • 617
  • 1
  • 9
  • 21
  • hi kfazithank you for your answer but it does not solve my problem?what shuld be the adrress?i do not know it must be a folder address?a file that browse the folder of images?what about upload address?could you help me please? – hamid May 10 '16 at 22:20