gpt4 book ai didi

ckeditor - CKFinder - 快速上传成功上传后未将 URL 传递到图像信息选项卡

转载 作者:行者123 更新时间:2023-12-02 08:04:13 24 4
gpt4 key购买 nike

当我使用“快速上传”选项卡上传文件时,成功上传后,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 - CKFinder - 快速上传成功上传后未将 URL 传递到图像信息选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20625536/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com