问题描述
在我的网站上集成CKFinder 3的ASP.NET版本时遇到了一个奇怪的问题.我正在创建一个模式实例,以选择一个文件来填充字段的值,但是使用 getUrl()
当 files:choose
事件被触发,我而是将以下URL返回给我,我一生都无法找出原因或解决方法.
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¤tFolder=%2Fpath%2Fto%2F&hash=[hash]&fileName=image.ext`
如果相关,我的"Web.config"中上载"目录的后端
信息如下所示:
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>
然后我用来创建模式实例并监听 files:choose
事件的JavaScript如下所示(我要填充的字段是按钮的上一个兄弟用于创建模式):
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);
更新:当我将CKFinder添加到CKEditor时,也会发生同样的事情.
UPDATE: The same thing is also happening when I add CKFinder to CKEditor.
推荐答案
要使用直接URL,您需要禁用代理命令功能:只需在后端配置中设置 useProxyCommand ="false"
,或完全删除此属性.此选项定义是直接链接到文件还是应该由连接器提供文件.
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.
这篇关于CKFinder 3返回所选文件的错误URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!