When I use the "Quick Upload" tab to upload a file, the URL is not passed to the "Image Info" tab after a successful upload. If I select OK from the "Quick Upload" after a successful upload, CKFinder switches to the "Image Info" tab, and the following error message "Image source URL is missing" appears. Can anyone shed light on why this might be occurring?
Asked
Active
Viewed 3,986 times
6
-
Are you using CKFinder or your own uploader? – AlfonsoML Jan 21 '14 at 21:11
-
I am using CKFinder's uploader – RHPT Jan 21 '14 at 21:25
-
Then you should ask their support team, it doesn't seem that SO is the correct place for your question. – AlfonsoML Jan 22 '14 at 14:56
2 Answers
1
Use this code.
In CKEditor config -
config.filebrowserUploadUrl = "/VirtualDirectoryName/ControllerName/ActionName";
Your Action Method
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();
}
}

Manjay_TBAG
- 2,176
- 3
- 23
- 43
0
It work for me with CKEditor 4. You can try like this:
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();
}

Hong Van Vit
- 2,884
- 3
- 18
- 43