简体   繁体   中英

CKFinder 3 Returning Wrong URLs for Selected Files

I've encountered a strange problem while integrating the ASP.NET version of CKFinder 3 on my site. I'm creating a modal instance to select a file to populate the value of a field but, instead of the expected URL of "/uploads/images/path/to/image.ext" using getUrl() when the files:choose event is fired, I am instead getting the following URL returned to me and I can't, for the life of me, figure out why or how to fix it.

http://domain.tld/path/to/ckf/connector?command=Proxy&lang=en&type=Images&currentFolder=%2Fpath%2Fto%2F&hash=[hash]&fileName=image.ext`

If it's relevant, the backend info for my "uploads" directory in "Web.config" looks like this:

<backend name="default" adapter="local" useProxyCommand="true">
    <option name="root" value="../../../uploads" />
    <option name="baseUrl" value="/uploads/" />
</backend>

And then the JavaScript I'm using to create the modal instance and listen for the files:choose event goes like this (the field I'm trying to populate is the previous sibling of the button used to create the modal):

document.getElementById("openckf").addEventListener("click",function(){
    var field=this.previousSibling;
    CKFinder.modal({
        onInit:function(finder){
            finder.on("files:choose",function(event){
                field.value=event.data.files.first().getUrl();
            });
        }
    });
},0);

UPDATE: The same thing is also happening when I add CKFinder to CKEditor.

To use direct URL-s you need to disable the proxy command feature: simply set useProxyCommand="false" in backend configuration, or completely remove this attribute. This option defines whether links to files should be direct, or files should be served by connector.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM