5
當我使用「快速上傳」標籤上傳文件時,在成功上傳後,URL不會傳遞到「圖片信息」標籤。如果在成功上傳後從「快速上傳」中選擇「確定」,則CKFinder切換到「圖像信息」選項卡,並出現以下錯誤消息「圖像源URL丟失」。任何人都可以闡明爲什麼這可能會發生?CKFinder - 快速上傳成功上傳後未將URL傳遞到圖片信息標籤
當我使用「快速上傳」標籤上傳文件時,在成功上傳後,URL不會傳遞到「圖片信息」標籤。如果在成功上傳後從「快速上傳」中選擇「確定」,則CKFinder切換到「圖像信息」選項卡,並出現以下錯誤消息「圖像源URL丟失」。任何人都可以闡明爲什麼這可能會發生?CKFinder - 快速上傳成功上傳後未將URL傳遞到圖片信息標籤
使用此代碼。
在CKEditor的配置 -
config.filebrowserUploadUrl = "/VirtualDirectoryName/ControllerName/ActionName";
動作方法
public class ControllerName: Controller
{
public ActionResult ActionName(HttpPostedFileBase upload, string CKEditorFuncNum, string CKEditor, string langCode)
{
if (upload != null)
{
string fileName = Guid.NewGuid() + Path.GetExtension(upload.FileName);
string basePath = Server.MapPath("~/Uploads");
upload.SaveAs(basePath + "\\" + fileName);
string url = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/Uploads/" + fileName;
HttpContext.Response.Write("<script>window.parent.CKEDITOR.tools.callFunction(" + CKEditorFuncNum + ", \"" + url + "\");</script>");
HttpContext.Response.End();
}
return View();
}
}
這對我的工作用的CKEditor 4.你可以嘗試這樣的:
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();
}
您是否使用CKFinder或你自己的上傳者? – AlfonsoML
我正在使用CKFinder的上傳器 – RHPT
然後你應該問他們的支持團隊,它似乎並不是你的問題的正確位置。 – AlfonsoML