CKEditor ASP.NET WebForms上载不起作用

时间:2017-01-04 12:41:27

标签: asp.net webforms ckeditor

CKEDITOR 4.6.1

我尝试了很多,但它没有出现在编辑器中。

upload.ashx

public void ProcessRequest(HttpContext context)
    {
        HttpPostedFile uploads = context.Request.Files["upload"];
        string CKEditorFuncNum = context.Request["CKEditorFuncNum"];
        string file = System.IO.Path.GetFileName(uploads.FileName);
        uploads.SaveAs(context.Server.MapPath(".") + "\\photo\\" + file);
        string url = "/photo/" + file;
        context.Response.Write("<script>window.parent.CKEDITOR.tools.callFunction(" + CKEditorFuncNum + ", \"" + url + "\");</script>");
        context.Response.End();
    }

的JavaScript

 <script type="text/javascript">
            $(function () {
                CKEDITOR.replace('<%=CKEditorControl1.ClientID %>', { filebrowserImageUploadUrl: '/Upload.ashx' }); veriyoruz
            });
</script>

HTML

<CKEditor:CKEditorControl ID="CKEditorControl1" BasePath="~/ckeditor/" runat="server"></CKEditor:CKEditorControl>

0 个答案:

没有答案