Search code examples
asp.net-coreuploadckeditorckeditor4

why ckeditor send null image to upload file


The following codes are the codes I wrote to use the ckeditor in asp core5 ,but When I upload the image, it sends null file to UploadFile function in controlller Why?

I hope you can help me because I really need it

Controller:
        [HttpPost]
        [AllowAnonymous]
        public IActionResult UploadFile(IFormFile File)
        {

            return Json(_postService.UploadFile(File));

        }

view:
<scripts>
        CKEDITOR.replace('Description', {

            filebrowserImageBrowseUrl: 'Uploads',
         
            filebrowserImageUploadUrl: '/Blog/UploadFile',

}
</scripts>

Solution

  • This public IActionResult UploadFile(IFormFile File) code used for choosing local image file without using ckeditor. When using ckeditor4, we can submit all the properities in model.

    enter image description here

    For more details, you can check the blog and the repo.

    Blog: Integrate CK Editor to ASP .NET Core MVC Web Application

    Repo: CKEditor-MSQL-DB