| <! DOCTYPE html> <title></title> <script src= "Ueditor/ueditor.config.js" type= text/javascript "charset=" utf-8″></script> <script src= "Ueditor/ueditor.config.js/ueditor.all.min.js" type= text/javascript "charset=" utf-8″></ Script> <!–, of course, will also introduce jquery–> var _editor; $ (function () { Re-instantiate an editor to prevent uploaded pictures or files from being displayed in the editor editor above _editor = Ue.geteditor (' Myeditor '); _editor.ready (function () { The settings editor is not available _editor.setdisabled (); Hide the editor because this instance of the editor is not used, so hide _editor.hide (); Listening for picture uploads _editor.addlistener (' Beforeinsertimage ', function (t, ARG) { Assign the address to the corresponding input, only the path to the first picture $ ("#pictrue"). attr ("value", ARG[0].SRC); Picture preview $ ("#picview"). attr ("src", "/public/" +arg[0][' src ')); }); Listen for file upload, take the path of the first uploaded file in the uploaded file list _editor.addlistener (' Afterupfile ', function (t, ARG) { var fileurl= ""; for (var i=0; i< arg.length i++) {//Implement multiple attachments upload. | split attachment Address if (Arg[i].url = = undefined) { Continue } if (i = = (arg.length-1)) { fileurl=fileurl+ (ARG[I].URL.SUBSTR (9)); }else{ fileurl=fileurl+ (ARG[I].URL.SUBSTR (9)) + "| |"; // } } $ ("#files"). attr ("value", FILEURL); }); }); }); Pop-up Image Upload dialog box function Upimage () { var myimage = _editor.getdialog ("Insertimage"); Myimage.open (); } Pop-up File Upload dialog box function Upfiles () { var myfiles = _editor.getdialog ("attachment"); Myfiles.open (); Www.111cn.net } If you need to assign a value to a text box, you also need to 119 lines in the dialogs\attachment\attachment.html file Editor.execcommand ("inserthtml", str); previous line add Editor.fireevent (' Afterupfile ', fileslist); Top of the program to achieve a multiple attachment upload, of course, you can refer to this modified multiple pictures upload <body> <script type= "Text/plain" id= "Myeditor" ></script> <script type= "Text/plain" id= "Upload_ue" ></script> Page to call: <input type= "text" id= "picture" name= "cover"/><a href= "javascript:void (0);" onclick= "upimage ();" > Upload Pictures </a> <input type= "text" id= "file"/><a href= "javascript:void (0);" onclick= "upfiles ();" > Upload file </a> </body> |