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?
The "Image Source URL Is Missing" error message seems to indicate that the uploader isn't passing the URL to CKEditor in a way that CKEditor can understand it. This page in the Developers Guide explains how to pass the the URL to CKEditor: Integrating CKEditor with a Custom File Browser.
Startup path was designed to work when browsing files. To set a different folder for the QuickUpload command, use "currentFolder" attribute: filebrowserImageUploadUrl : '/ckfinder/core/connector/php/connector.
To upload a new image open the upload panel in the image browser. Open the Image info tab and click Browse server. A new window will open where you see all your uploaded images. Open the Settings to choose another upload path.
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();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With