日期:2014-05-17  浏览次数:20469 次

CKEditor.NET自定义上传文件的的问题
本帖最后由 showyusy 于 2013-09-11 11:19:18 编辑
我在工具箱里面把CKEditor添加上以后拖到网页里面。
<CKEditor:CKEditorControl ID="objCKE" runat="server" BasePath="/ckeditor/" Height="600px" FilebrowserImageUploadUrl="/ashx/UpLoad.ashx"></CKEditor:CKEditorControl>
代码如上,网页中可以正常显示。
UpLoad.ashx里面的代码如下
if (context != null)
        {
            HttpPostedFile hpf = context.Request.Files[0];
            string oldname = hpf.FileName;
            oldname = oldname.Substring(oldname.LastIndexOf("\\") + "\\".Length);
            DateTime temp = DateTime.Now;
            string newname = temp.ToString("yyyyMMddHHmmss") + oldname.Substring(oldname.LastIndexOf("."));
            string date = temp.ToString("yyyyMMdd");
            string serverpath = "/Files/image/" + date + "/";
            string path = context.Server.MapPath("/Files/image/" + date + "/");
            if (Directory.Exists(path))
            {
                hpf.SaveAs(path + newname);
            }
            else
            {
                Directory.CreateDirectory(path);
                hpf.SaveAs(path + newname);
            }
        }

运行之后发现服务器里面也确实保存了这个图像文件。但是编辑器里面却没有这个图像。求指点,如何让这个上传过的图片显示在CKEditor编辑器里。
ckeditor 编辑器