Skip to content

CKEditor drag&drop files #5415

@FRMN-FRE

Description

@FRMN-FRE

Drag&Drop files on the CKEditor provide an "Internal Server Error"
image

Steps to reproduce

-Open an HTML Module
-Drag&drop a picture on it

  • the image is well uploaded on the good folder but an issue stop the process to import it on the editor.

Error information

image

Additional context

How to fix this bug
Modify the file D:\dnn\dnnsources\Dnn.Platform-9.11.0\DNN Platform\Providers\HtmlEditorProviders\DNNConnect.CKE\Browser\Browser.aspx.cs
Find the procedure UploadFile, replace the script by a json response.
private void UploadFile(HttpPostedFile file, string command)
...

               if (command == "EasyImageUpload")
                {
                    var fileUrl = string.Format(!MapUrl(uploadPhysicalPath).EndsWith("/") ? "{0}/{1}" : "{0}{1}", MapUrl(uploadPhysicalPath), fileName);
                    this.Response.ClearContent();
                    this.Response.ContentType = "application/json";
                    this.Response.Write($"{{\"default\": \"{fileUrl}\"}}");
                }
                else
                {
                    var fileUrl = string.Format(!MapUrl(uploadPhysicalPath).EndsWith("/") ? "{0}/{1}" : "{0}{1}", MapUrl(uploadPhysicalPath), fileName);
                    this.Response.ClearContent();
                    this.Response.ContentType = "application/json";
                    this.Response.Write($"{{\"uploaded\": 1, \"fileName\": \"{fileName}\", \"url\": \"{fileUrl}\"}}");
                    //this.Response.Write("<script type=\"text/javascript\">");
                    //this.Response.Write(this.GetJsUploadCode(fileName, MapUrl(uploadPhysicalPath)));
                    //this.Response.Write("</script>");
                }
                this.Response.End();

Affected version

All DNN versions since introduction of DNNConnect.CKEditorProvider.dll which replace the DNNConnect.CKEditorProvider_01.00.04.zip extension.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions