Does anyone know how to use the editor1.ExecCommand('insertimage'); to upload and select an image and have the Insert button cause a textbox to be filled with a path to the image file?
Here is the javascript I have tried but doesn't write path back to imageFld textbox:
function callInsertIMG()
{
var editor2 = document.getElementById('<%=editor2.ClientID%>');
editor2.FocusDocument();
var editdoc = editor2.GetDocument();
editor2.ExecCommand('new');
editor2.ExecCommand('insertimage');
InputIMG();
document.getElementById("ctl00_ContentPlaceHolder1_imageFld").focus();
}
function InputIMG()
{
var editor2 = document.getElementById('<%=editor2.ClientID%>');
var editdoc = editor2.GetDocument();
var links = editdoc.getElementsByTagName("a");
if(links.length>0&&links[links.length-1].href!="")
{ document.getElementById("ctl00_ContentPlaceHolder1_imageFld").value = links[links.length-1].href;
}
else
{
setTimeout(InputIMG,500);
}
}