uploadify图片上传配置
参考:http://www.cnblogs.com/XuebinDing/archive/2012/04/26/2470995.html
官网地址:http://www.uploadify.com/
附件下载地址:http://files.cnblogs.com/files/miskis/uploadify.zip
引用js、css
<link rel="stylesheet" href="/assets/uploadify/uploadify.css">
<link rel="stylesheet" href="/assets/css/iconfont.css"> <script src="/assets/jquery-1.11.1.min.js"></script>
<script src="/assets/uploadify/jquery.uploadify.js" ></script>
<script src="/assets/uploadify/jquery.uploadify.defaultOpt.js" ></script>
html
<div id="js_showImgs" ></div>
<input type="file" name="uploadify" id="uploadify" />
js代码
$("#uploadify").uploadify($.extend(true,defaultOptions,{
uploader: 'http://172.16.81.52:7080/web/file/uploadImage', // 服务器处理地址
swf: '/assets/uploadify/uploadify.swf',
buttonText: "选择文件", //按钮文字
height: 34, //按钮高度
width: 82, //按钮宽度
fileTypeExts: "*.jpg;*.png;", //允许的文件类型
fileTypeDesc: "请选择图片文件", //文件说明
formData: { "imageFile": "imageFile" }, //提交给服务器端的参数
fileObjName: 'imageFile',
fileSizeLimit: '2MB', //文件大小,它接受一个单位(B,KB,MB或GB)。默认单位为KB。你可以设置这个值为0表示不限制。
uploadLimit: 1,//图片张数限制
onUploadSuccess: function (file, data, response) { //一个文件上传成功后的响应事件处理
var fileData = $.parseJSON(data);
//组装图片地址
var imgurl="http://172.16.81.52:81/"+ fileData.data.originalUrl;
AddImage(imgurl,"uploadify-img","js_showImgs",0);
}
}));
/*********************
* 图片预览
* imgUrl 图片路径
* imgName 图片隐藏域id
* renderTo 图片预览追加位置id
* index 用于多图片时修改div的class
**********************/
window.AddImage=function(imgUrl, imgName, renderTo, index){
index++;
var imgItem = '<div class="album-image album-image'+index+'" >' +
' <div style="height:120px;">' +
' <input type="hidden" id="'+imgName+'" value="' + imgUrl + '"/>' +
' <img src="' + imgUrl + '" >' +
' </div>' +
' <div class="album-tools" title="删除图片">' +
' <span class="image-options text-right">' +
' <i class="icon iconfont icon-shanchu" ></i>' +
' </span>' +
' <div class="clearfix"></div>'+
' </div>' +
' </div>';
$("#"+renderTo).append(imgItem);
//移除预览图片
$("#"+renderTo).find(".album-tools").click(function(){
//获取上传文件的属性
var data = $('#uploadify').data('uploadify');
var settings = data.settings;
//获取当前设置的上传文件数限制
var uploadLimit=settings.uploadLimit;
//重置上传限制
$('#uploadify').uploadify('settings','uploadLimit', ++uploadLimit);
//移除图片元素
$("#"+renderTo).find(".album-image"+index+"").remove();
})
}
uploadify图片上传配置的更多相关文章
- asp.net 百度编辑器 UEditor 上传图片 图片上传配置 编辑器配置 网络连接错误,请检查配置后重试
1.配置ueditor/editor_config.js文件,将 //图片上传配置区 ,imageUrl:URL+"net/imageUp.ashx" //图片上传提交地址 ,im ...
- uploadify图片上传发生Security Error
今天在使用uploadify进行图片上传的时候出现security error.其根本原因是flash跨域问题.主要原因是因为配了两个域名www.ttyouni.com 和 ttyouni.com 在 ...
- ueditor图片上传配置
ueditor图片上传配置文件为ueditor/php/config.json /* 上传图片配置项 */ "imageActionName": "uploadimage ...
- kindeditor在Java项目中的应用以及图片上传配置
在官网下载Kindededitor的开发包 在项目中javaweb项目中导入kindeditor必须要使用的Jar包(用于文件上传,除非你的富文本编辑器不使用图片上传)jar包可以在官网的开发包中 ...
- .net_ckeditor+ckfinder的图片上传配置
CKEditor和CKFinder的最新版可以到官方网站(http://cksource.com)上下载获得. 把以上两个资源放到网站的根目录: /CKEditor 和 /CKFinder (不区分大 ...
- uploadify 图片上传
遇到的问题总结: 1.//图片排序 $("#pics").sortable(); 2.//上传的文件对象名,与后台所传参数名保持一致,最初因为这个名称错误浪费了许久时间 fileO ...
- 关于UEditor的使用配置(图片上传配置)
接到新需求,需要在平台上使用富文本编辑器,我这次选择了百度的UEditor 在官网上下载l.net版本的1.4.3开发版本 http://ueditor.baidu.com/website/downl ...
- ckeditor4.7配置图片上传
ckeditor作为老牌的优秀在线编辑器,一直受到开发者的青睐. 这里我们讲解下 ckeditor最新版本4.7的图片上传配置. https://ckeditor.com/ 官方 进入下载 https ...
- [Asp.net core 2.0]Ueditor 图片上传
摘要 在项目中要用到富文本编辑器,包含上传图片,插入视频等功能.但ueditor只有.net版本,没有支持core.那么上传等接口就需要自己实现了. 一个例子 首先去百度ueditor官网下载简化版的 ...
随机推荐
- [leetcode-784-Letter Case Permutation]
Given a string S, we can transform every letter individually to be lowercase or uppercase to create ...
- POJ 3608 Bridge Across Islands(计算几何の旋转卡壳)
Description Thousands of thousands years ago there was a small kingdom located in the middle of the ...
- 《javascript模式--by Stoyan Stefanov》书摘--汇总
<javascript模式--by Stoyan Stefanov>书摘--基本技巧 http://www.cnblogs.com/liubei/p/JavascriptModeLog1. ...
- 什么是BCL
原文: 原文:https://www.cnblogs.com/1996V/p/9037603.html 什么是BCL 当你通过VS创建一个项目后,你这个项目就已经引用好了通过.NET下的语言编写好的一 ...
- 《剑指offer》---输出链表倒数第k个结点
本文算法使用python3实现 1 题目描述: 输入一个链表,输出该链表中倒数第k个结点. 时间限制:1s:空间限制:32768K 2 思路描述: 方法一:当链表长度为 $ n $ 时,输 ...
- 使用LoadRunner脚本采集Linux性能数据
前面介绍过在LoadRunner的Java协议实现“使用SSH连接Linux”.下面的脚本,是在LoadRunner里连接Linux/Unix远程服务器,收集其磁盘IO的负载到测试结果. 涉及到三个知 ...
- 第二章 持续集成jenkins工具使用之系统基本设置
Jenkin系统初始化成功后,会进入用户设置页面,设置用户信息后即可进入系统,如果没有设置用户,jenkins系统默认的用户是admin,密码administrator 1.1 Con ...
- java数据结构-HashMap
一直以来似乎都有一个错觉,认为map跟其他的集合类一样继承自Collection,其实不然,Map和Collection在结构层次上是没有任何关系的,通过查看源码可以发现map所有操作都是基于key- ...
- ping traceroute原理
ping命令工作原理 ping命令主要是用于检测网络的连通性. Ping命令发送一个ICMP请求报文给目的IP,然后目的IP回复一个ICMP报文. 原理:网络上的机器都有唯一确定的IP地址,我们给目标 ...
- 第28天:js-Tab栏切换封装函数
一.input.value所有值都是string 二.变量和属性var index=10;//变量var arr=[];//数组arr.index=20;//index为自定义属性,只能在arr下使用 ...