Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue that prevented uploading images using the HTML Editor #5656

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2419,10 +2419,20 @@ private void UploadFile(HttpPostedFile file, string command)
}
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}\"}}");
// querystring parameter responseType equals "json" when the request comes from drag/drop
if (this.Request.QueryString["responseType"]?.Equals("json", StringComparison.InvariantCultureIgnoreCase) == true)
{
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}\"}}");
}
else
{
this.Response.Write("<script type=\"text/javascript\">");
this.Response.Write(this.GetJsUploadCode(fileName, MapUrl(uploadPhysicalPath)));
this.Response.Write("</script>");
}
}

this.Response.End();
Expand Down