ueditor單獨圖片和附件上傳功能

來源:互聯網
上載者:User

標籤:

首要要載入ueditor的2個js

    <script src="../ueditor/ueditor.config.js" type="text/javascript"></script>    <script src="../ueditor/ueditor.all.js" type="text/javascript"></script>

  

    <table>      <tr>        <td>            <asp:TextBox ID="txtImgurl" runat="server"></asp:TextBox>            <input type="button" id="btnImageUpLoader" value="上傳" onclick="upImage()" />          </td>      </tr>      <tr>        <td>            <asp:TextBox ID="txtAttachments" runat="server"></asp:TextBox>            <input type="button" id="btnFileUpLoader" value="上傳" onclick="upFile()" />          </td>      </tr>     </table>

  

<script type="text/javascript">    UE.getEditor(‘txtContent‘);</script>       <script type="text/javascript">       var myEditor = new UE.ui.Editor;       myEditor.render(‘btnFileUpLoader‘);        myEditor.ready(function() {           myEditor.setDisabled();           myEditor.hide();           myEditor.addListener(‘beforeInsertImage‘, function (t, arg) {                      //因為可以上傳多張,所以就用arg[0]               $("#txtImgurl").attr("value", arg[0].src);           });           myEditor.addListener(‘afterUpfile‘, function (t, arg) {                    //這裡這個事件需要到 dialogs\attachment\attachment.html 中                                                                               //在editor.execCommand("insertHTML",str);前面添加               $("#txtAttachments").attr("value", arg[0].url);                        //editor.fireEvent(‘afterUpfile‘, filesList);           });       });       function upImage() {           var m;           m = myEditor.getDialog("insertimage");           m.render();           m.open();       }       function upFile() {           var f;           f = myEditor.getDialog("attachment");           f.render();           f.open();       }       //在使用ueditor單獨附件上傳功能的時候點擊"上傳"按鈕時不會出現 檔案上傳對話方塊,       //Uncaught TypeError: Cannot read property ‘render‘ of undefined 這是因為在ueditor.config.js        //中對toolbars 配置是把 ‘attachment‘ 工具去掉了,只要添加上去就可以了   </script>

 

ueditor單獨圖片和附件上傳功能

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.