jquery Cleditor plugin attach file option

167 Views Asked by At

Am using cleditor plugin for my application. In that i need attach documents option(like ms-word). So am using the below code to achieve attach option. It is successfully added document as a hyperlink in the editor but am not able to click & open the link.

Can anyone help me on this. or else suggest me any alternate approach to the same.

Note : Finally i want to save the content of the attached file into Database. please give any suggestion to this also.

Thanks in advance.

Code

(function(n)
{
  function t(t,i)
  {
    n(i.popup).children(":button").unbind("click").bind("click",function()
    {
      var     r=i.editor,u=n(i.popup).find(":text"),v=n(i.popup).find(":file"),f=v[0].value,e=u[0].value,t;
  if(f!=""&&e!=""){
  t="<a href="+f+" target=_blank>"+e+"<\/a>";
  t&&r.execCommand(i.command,t,null,i.button);
   }
  t&&r.execCommand(i.command,t,null,i.button);
  r.hidePopups();
  r.focus()
});
}
 n.cleditor.buttons.file=
 {
   name:"file",
   image:"file.gif",
   title:"Insert File",
   command:"inserthtml",
   popupName:"file",
   popupClass:"cleditorPrompt",
   popupContent:'<label>Url:&nbsp;&nbsp;&nbsp;&nbsp;<input type="file" value=""   style="width:250px"><\/label><br /><label>Title:<br /><input type="text" value="" style="width:70px"><\/label><br /><input type="button" value="Submit">',
   buttonClick:t
 };
        n.cleditor.defaultOptions.controls=n.cleditor.defaultOptions.controls.replace("rule ","rule file ")
    }
)(jQuery);
0

There are 0 best solutions below