if(rte.imageModule.dialogObj) {
rte.imageModule.uploadObj.selected = function(e){
console.log(e.filesData[0]);
};
rte.imageModule.uploadObj.success = function(e){
console.log(e);
}
} |
[AcceptVerbs("Post")]
public void Save()
{
if (System.Web.HttpContext.Current.Request.Files.AllKeys.Length > 0)
{
var httpPostedFile = System.Web.HttpContext.Current.Request.Files["UploadFiles"];
if (httpPostedFile != null)
{
var fileName = Path.GetFileName(httpPostedFile.FileName);
fileName = "RTE_" + fileName;
var destinationPath = Path.Combine(Server.MapPath("~/Images"), fileName);
httpPostedFile.SaveAs(destinationPath);
Response.StatusDescription = fileName;
}
}
} |
public ontoolbarClick(e, rte: RichTextEditor) {
if(rte.imageModule.dialogObj) {
let selection: NodeSelection = new NodeSelection();
let range = selection.getRange(rte.contentModule.getDocument());
let save: NodeSelection = selection.save(range, rte.contentModule.getDocument());
let selectParent: Node[] = selection.getParentNodeCollection(range);
rte.imageModule.uploadObj.success = function(e: any){
var url = rte.insertImageSettings.path + e.e.currentTarget.statusText;
var altText = e.e.currentTarget.statusText;
(rte.imageModule as any).uploadUrl = { url: url, selection: save, altText: altText, selectParent: selectParent};
}
}
} |
public ontoolbarClick(e, rte: RichTextEditor) { // Triggered when toolbar icon clicked
if (rte.imageModule.dialogObj) {
var successEvent = rte.imageModule.uploadObj.success; // Get the source level uploader success event
var proxy = rte.imageModule.uploadObj;
rte.imageModule.uploadObj.success = function (e: any) {
e.file.name = e.e.currentTarget.getResponseHeader('name'); // Get the server side changed image name
let filename = <HTMLElement>document.querySelectorAll(".e-file-name")[0];
filename.innerHTML = e.file.name.replace(document.querySelectorAll(".e-file-type")[0].innerHTML, ''); // Change the uploader file name after selected the image
filename.title = e.file.name;
successEvent.call(proxy, e); // Triggered source level success event
};
}
} |