2019独角兽企业重金招聘Python工程师标准>>>

本人一直喜欢精简的大代码,ueditor  感觉有点大。umeditor是他的精简版,所有就用umeditor了.

umeditor 和ueditor 我看了下代码都只提供了单图片上传。

imageUp.php:

把两处修改了.

<?phpheader("Content-Type:text/html;charset=utf-8");error_reporting( E_ERROR | E_WARNING );date_default_timezone_set("Asia/chongqing");include "Uploader_ext.class.php";  //上传配置$config = array("savePath" => "upload/" ,             //存储文件夹"maxSize" => 2040 ,                   //允许的文件最大尺寸,单位KB"allowFiles" => array( ".gif" , ".png" , ".jpg" , ".jpeg" , ".bmp" )  //允许的文件格式);//上传文件目录$Path = "upload/";//背景保存在临时目录中$config[ "savePath" ] = $Path;$up = new Uploader_ext( "upfile" , $config );$type = $_REQUEST['type'];$callback=$_GET['callback'];$info = $up->getFileInfo();/*** 返回数据*/if($callback) {echo '<script>'.$callback.'('.json_encode($info).')</script>';} else {echo json_encode($info);}

最主要的上传代码:

    private function upFile($base64){ // 处理base64上传/*** if ( "base64" == $base64 ) {* $content = $_POST[ $this->fileField ];* $this->base64ToImage( $content );* return;* }*/// 处理普通上传$file = $this -> file = $_FILES[ $this -> fileField ];if (!$file){$this -> stateInfo = $this -> getStateInfo('POST');return;} $this -> all_data = array();$_count = count($_FILES[ $this -> fileField ]['name']);for($i = 0;$i < $_count;$i++){if ($this ->file[ 'error' ][$i] !=0){$this -> stateInfo = $this -> getStateInfo($file[ 'error' ]);return;} if (!is_uploaded_file($file[ 'tmp_name' ][$i])){$this -> stateInfo = $this -> getStateInfo("UNKNOWN");return;} $this -> oriName = $file[ 'name' ][$i];$this -> fileSize = $file[ 'size' ][$i];$this -> fileType = $this -> getFileExt($file[ 'name' ][$i]);if (!$this -> checkSize()){$this -> stateInfo = $this -> getStateInfo("SIZE");return;} if (!$this -> checkType($this -> fileType)){$this -> stateInfo = $this -> getStateInfo("TYPE");return;} $folder = $this -> getFolder();if ($folder === false){$this -> stateInfo = $this -> getStateInfo("DIR_ERROR");return;} $this -> fullName = $folder . '/' . $this -> getName($this -> fileType);if ($this -> stateInfo == $this -> stateMap[ 0 ]){if (!move_uploaded_file($file[ "tmp_name" ][$i] , $this -> fullName)){$this -> stateInfo = $this -> getStateInfo("MOVE");} } $this -> all_data[] = array("originalName" => $file[ 'name' ][$i] ,"name" => $this -> fileName ,"url" => $this -> fullName ,"size" => $file[ 'size' ][$i] ,"type" => $this -> fileType ,"state" => $this -> stateInfo);} } 

js代码中处理:

主要调用:Base.callback(me.editor, me.dialog, item.url, item.state);

$.each(json,function(idx,item){ //alert("value:"+item.url); Base.callback(me.editor, me.dialog, item.url, item.state);}); 
        uploadTpl: '<div class="edui-image-upload%%">' +'<span class="edui-image-icon"></span>' +'<form class="edui-image-form" method="post" enctype="multipart/form-data" target="up">' +'<input style=\"filter: alpha(opacity=0);\" class="edui-image-file" type="file" hidefocus name="upfile[]"  multiple="multiple" accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"/>' +'</form>' +'</div>',

转载于:https://my.oschina.net/mickelfeng/blog/779620

[umeditor] 多图片一次上传功能相关推荐

  1. html上传图片裁剪,基于HTML5+JS实现本地图片裁剪并上传功能

    基于HTML5+JS实现本地图片裁剪并上传功能 2019-01-07 编程之家 https://www.jb51.cc 编程之家收集整理的这篇文章主要介绍了基于HTML5+JS实现本地图片裁剪并上传功 ...

  2. php 点击选择图片上传,简易的图片点击上传功能

    这次给大家带来简易的图片点击上传功能, 做出简易的图片点击上传功能注意事项有哪些,下面就是实战案例,一起来看一下. 简易图片点击上传预览示例.chrome,火狐等浏览器 下可支持拖拽预览 //--从 ...

  3. java上传头像插件_JSP+SpringMVC框架使用WebUploader插件实现注册时候头像图片的异步上传功能...

    一.去官网下载webuploader文件上传插件 下载好后把它放到Javaweb项目的文件夹中(我放到了webcontent下面的static里面) 二.复制前端的样式 把这段代码放到你想要放到的位置 ...

  4. php 防微信照片上传,PHP仿微信多图片预览上传功能

    [html] view plain copy 在CODE上查看代码片派生到我的代码片 plupload上传 [javascript] view plain copy 在CODE上查看代码片派生到我的代 ...

  5. quill富文本编辑器——修改默认图片、视频上传功能

    quill富文本编辑器默认的图片上传是将图片地址转换为base64格式,可能会导致字段过长:默认的视频上传是插入iframe标签,与需要的video标签不符合 图片上传 初始化编辑器时重写image上 ...

  6. php仿微信多图片预览上传,PHP仿微信多图片预览上传功能

    [html] view plain copy 在CODE上查看代码片派生到我的代码片 plupload上传 [javascript] view plain copy 在CODE上查看代码片派生到我的代 ...

  7. uniapp怎么调起摄像头拍视频_uni-app实现图片和视频上传功能

    var sourceType =[ ['camera'], ['album'], ['camera', 'album'] ] exportdefault{ data() {return{ imageL ...

  8. 类似新浪微博和google图片的HTML5实现图片拖拽上传功能

    2019独角兽企业重金招聘Python工程师标准>>> 来源: http://www.lovesunlife.com/?p=315 这篇文章对google图片为蓝本就拖拽上传功能分析 ...

  9. vue本地上传并预览php,vue.js 实现图片本地预览 裁剪 压缩 上传功能

    以下代码涉及 Vue 2.0 及 ES6 语法. 目标 纯 javascrpit 实现,兼容ie9及以上浏览器,在本地做好文件格式.长宽.大小的检测,减少浏览器交互. 现实是残酷的,为了兼容Ie9 还 ...

最新文章

  1. 假如曹操是一名程序员,会发生什么?
  2. android 分支管理,Android Studio git使用,包括协同开发,分支管理。
  3. JVM 年轻代(Eden、From、To)、老年代讲解
  4. Java程序设计4——集合类
  5. ECCV 2020 | 视觉引导的声源分离辅助立体声重构方法 Sep-Stereo
  6. 不重复点名抽奖_抽奖新玩法?和平精英蜘蛛异变套装上线 参与十次可获得所有奖励...
  7. 2020 年百度之星·程序设计大赛 - 复赛 1001Battle for Wosneth
  8. 一、配置etcd数据库
  9. [2018.04.23 T3] 最大值
  10. SQL Server 2008空间数据应用系列十一:提取MapInfo地图数据中的空间数据解决方案...
  11. GPS章节要义(补充计算题)
  12. CherryTree:一款免费开源的富文本笔记软件
  13. TeamViewer 免费许可到期的解决办法
  14. 2021软科 中国计算机专业 排名
  15. 举个栗子~Tableau 技巧(226):用分段条形图呈现数据占比
  16. 开关电源个人总结(电感部分与滤波电容)
  17. 2023年中职网络安全竞赛服务远程控制任务解析
  18. java自我介绍_口语化java自我介绍
  19. 人口流向数据_中国各地人口净流入流出示意图
  20. kaggle+feature engineering(知乎抄的

热门文章

  1. matlab 弹出提示,谁能告诉我为什么一打开matlab2014b就弹出一个框就自动退出
  2. java程序ssh置顶_使用shell脚本启动远程(SSH)Java应用程序不会返回本地提示
  3. python病毒扫描器_基于Python的病毒扫描机制
  4. jvm调优工具_JVM性能调优监控工具jps、jstack、jmap、jhat、hprof使用详解
  5. 【java】兴唐第十八节课
  6. 微软浏览器适配问题前端_「图」微软新贡献:修复Chromium浏览器的奇怪触控板手势问题...
  7. ant 接口返回文件流,前端自动下载实现
  8. 微信小程序的数字有部分会自动加粗的解决方法
  9. PHP 3 HTML POST带参数请求 后端返回json格式的数据给前端
  10. 【iOS】通讯录分组方式展示数据