Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用asp.net在CKFINDER中上载文件时文件扩展名无效_C#_Asp.net_Ckeditor_Fckeditor_Ckfinder - Fatal编程技术网

C# 使用asp.net在CKFINDER中上载文件时文件扩展名无效

C# 使用asp.net在CKFINDER中上载文件时文件扩展名无效,c#,asp.net,ckeditor,fckeditor,ckfinder,C#,Asp.net,Ckeditor,Fckeditor,Ckfinder,我正在asp.net项目中使用CKFinder 2.4.1.2663和CKEditor 3.6.4.0。我可以上载图像,但当我尝试上载任何文件(如doc、xls或pdf)并单击“将其发送到服务器”按钮时,会显示此错误:文件扩展名无效。 在我的代码隐藏中,我写了以下内容: protected override void OnLoad(EventArgs e) { CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();

我正在asp.net项目中使用CKFinder 2.4.1.2663和CKEditor 3.6.4.0。我可以上载图像,但当我尝试上载任何文件(如doc、xls或pdf)并单击“将其发送到服务器”按钮时,会显示此错误:文件扩展名无效。

在我的代码隐藏中,我写了以下内容:

protected override void OnLoad(EventArgs e)
{
    CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();
    _FileBrowser.BasePath = "/ckfinder/";
    _FileBrowser.SetupCKEditor(CKEditor1);
}
Config.ascx中,我更改了此代码

public override bool CheckAuthentication()
{
    // WARNING : DO NOT simply return "true". By doing so, you are allowing
    // "anyone" to upload and list the files in your server. You must implement
    // some kind of session validation here. Even something very simple as...
    //
    //        return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
    //
    // ... where Session[ "IsAuthorized" ] is set to "true" as soon as the
    // user logs on your system.
    return true;
}
我正在像这样使用我的aspx中的控件

<CKEditor:CKEditorControl ID="CKEditor1" runat="server"></CKEditor:CKEditorControl>


我必须使用CKFinder的图像和任何类型的文件扩展名。我哪里做错了?

从外观上看,doc和xls文件扩展名在您的Config.ascx中是不允许的

默认情况下,在CKFINDER窗口中,根文件夹是images,在Config.ascx文件中,这些文件扩展名(doc,xls)未包含在images文件夹的ResourceType中

因此,要消除此错误,请打开Config.ascx文件,将您想要的扩展名(doc、xls)添加到baseUrl“images”中,类似下面的内容,然后添加

“allowedExtensions”=>“bmp、gif、jpeg、jpg、png、doc、xls

注意:不要更改任何内容,只需添加以逗号分隔的扩展名即可

我知道这会解决你的问题,因为这是我的问题,我通过这种方式解决了。但是如果你不介意,你可以粘贴完整的config.ascx文件,我直接更新,你复制并粘贴到你的系统上,然后运行它