I am using CKEditor in my application as rich text box. It is used to provide bullets and numbering. Now we need to upload images in between the text. So how can i accomplish this? What all configuraion is to be set? Also should i use CKFinder for this? If so please detail me on this.
问问题
2118 次
1 回答
1
你可以这样尝试:
在视野中。
filebrowserImageUploadUrl: '../../Upload/uploadnow'
在控制器中
public ActionResult uploadnow(HttpPostedFileWrapper upload, string CKEditorFuncNum)
{
string path = "";
string pathWeb ="";
if (upload != null)
{
string ImageName = upload.FileName;
string extention = Path.GetExtension(ImageName);
string name = DateTime.Now.ToString("yyMMddhhmmssms");
ImageName = name + extention;
pathWeb = "/images/uploads/" + ImageName;
path = System.IO.Path.Combine(Server.MapPath("~/images/uploads"), ImageName);
upload.SaveAs(path);
HttpContext.Response.Write("<script>window.parent.CKEDITOR.tools.callFunction(" + CKEditorFuncNum + ", \"" + pathWeb + "\");</script>");
HttpContext.Response.End();
}
return View();
}
于 2017-07-01T05:57:32.547 回答