請教大家
參考https://www.dotblogs.com.tw/chichiBlog/2020/05/13/122030 說明, 有邦友知道controller設定是要加在那裏呢?
contorller 設定
(路徑的部分請自行修正)
//CKEditorFuncNum,是ckeditor呼叫時自動把參數加在網址上傳(GET)過來的,
//目的是識別最後要把圖片塞到哪個ckeditor
[HttpPost]
public ActionResult UploadImg( string CKEditorFuncNum, HttpPostedFileBase upload)
{
string path = "";
string message = "";
if (upload != null)
{
string filename = Path.GetFileName(upload.FileName);
if (upload.ContentLength > 0)
{
path = Path.Combine(Server.MapPath("~/upload/img"), filename);
upload.SaveAs(path);
string imgUrl = "/upload/img" + filename;
message = "window.parent.CKEDITOR.tools.callFunction('" + CKEditorFuncNum + "', '"+ imgUrl + "')";
}
}
else
{
message = "上傳失敗";
}
return Content("<script>" + message + "</script>");
}