惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
W
WeLiveSecurity
O
OpenAI News
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Webroot Blog
Webroot Blog
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
N
News | PayPal Newsroom
H
Hacker News: Front Page
博客园_首页
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
The Last Watchdog
The Last Watchdog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Heimdal Security Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Schneier on Security
宝玉的分享
宝玉的分享
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
Microsoft Security Blog
Microsoft Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
GbyAI
GbyAI
Cloudbric
Cloudbric
TaoSecurity Blog
TaoSecurity Blog
人人都是产品经理
人人都是产品经理
P
Palo Alto Networks Blog
M
MIT News - Artificial intelligence
G
GRAHAM CLULEY
C
Check Point Blog
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
T
Troy Hunt's Blog
L
Lohrmann on Cybersecurity
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
量子位
博客园 - 聂微东
S
Securelist
博客园 - 三生石上(FineUI控件)
F
Full Disclosure
G
Google Developers Blog
L
LINUX DO - 热门话题
P
Proofpoint News Feed
AI
AI
PCI Perspectives
PCI Perspectives

博客园 - 飞花雪月

ASP.NET Core-wwwroot文件夹 ASP.NET MVC4中的bundles特性引发服务器拒绝访问(403错误) 两步验证Authy时间同步问题 您的项目引用了最新实体框架;但是,找不到数据链接所需的与版本兼容的实体框架数据库 EF6使用Mysql的技巧 Easyui Tree方法扩展 - getLevel(获取节点级别) HTML5添加 video 视频标签后仍然无法播放的解决方法 IIS添加MIEI类型 ASP.NET性能优化之减少请求 ASP.NET中获取当日,当周,当月,当年的日期 Convert.ToInt32()与int.Parse()的区别 C#/JS 获取二维数组组合 【转】浅析Sql Server参数化查询 【转】Sql Server参数化查询之where in和like实现之xml和DataTable传参 【转】Sql Server参数化查询之where in和like实现详解 推薦使用 Microsoft Anti-Cross Site Scripting Library V3.0 推薦使用 Microsoft Anti-Cross Site Scripting Library v3.1 IIS中ASP.NET安全配置 好用的SQLSERVER数据库自动备份工具SQLBackupAndFTP(功能全面) iframe在ipad safari的显示 从WEB SERVICE 上返回大数据量的DATASET
教你如何调用百度编辑器ueditor的上传图片、上传文件等模块
飞花雪月 · 2015-07-12 · via 博客园 - 飞花雪月

出于兴趣爱好,前段时间自己尝试写了一个叫simple的cms,里面使用了百度ueditor编辑器,发现它的多图片上传模块很不错,用起来很方便,又可以选择已经上传好的图片。正好我又是个懒人,发现有现成的自己就不想新开发了。于是我就想,是不是可以调用这个上传模板为自己所用呢?

有了这个想法后,我就到网上查阅资料,可惜资料少的可怜,都不能很好解决我的问题。于是觉得还是自己动手丰衣足食,皇天不负苦心人,终于摸索出解决方法,现在分享出来,和自己有同样想法的小伙伴。

代码如下:

<html>
  <head>
    <script src="ueditor/ueditor1.43.config.js"></script>
    <script src="ueditor/ueditor1.43.all.min.js"></script>
  </head>
  <body>
     
    <script type="text/plain" id="j_ueditorupload" style="height:5px;display:none;" ></script>
    <script>
      //实例化编辑器
      var o_ueditorupload = UE.getEditor('j_ueditorupload',
      {
        autoHeightEnabled:false
      });
      o_ueditorupload.ready(function ()
      {
     
    o_ueditorupload.hide();//隐藏编辑器
     
    //监听图片上传
    o_ueditorupload.addListener('beforeInsertImage', function (t,arg)
    {
          alert('这是图片地址:'+arg[0].src);
    });
     
    /* 文件上传监听
     * 需要在ueditor.all.min.js文件中找到
     * d.execCommand("insertHtml",l)
     * 之后插入d.fireEvent('afterUpfile',b)
     */
        o_ueditorupload.addListener('afterUpfile', function (t, arg)
        {
          alert('这是文件地址:'+arg[0].url);
        });
      });
       
      //弹出图片上传的对话框
      function upImage()
      {
        var myImage = o_ueditorupload.getDialog("insertimage");
        myImage.open();
      }
      //弹出文件上传的对话框
      function upFiles()
      {
        var myFiles = o_ueditorupload.getDialog("attachment");
        myFiles.open();
      } 
    </script>
     
    <button type="button" onClick="upImage()">调用上传图片模块</button>
    <br>
    <button type="button" onClick="upFiles()">调用上传文件模块</button>
     
  </body>
<html>

 注意:需要在ueditor.all.min.js文件中找到d.execCommand("insertHtml",l)之后插入d.fireEvent('afterUpfile',b)