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官网下载简化版的 ...
随机推荐
- nodejs基础学习
一:复制官网的代码,建立一个简单的服务器 const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; ...
- MFC消息处理
1.MFC窗口如何与AfxWndProc建立联系. 当一个新的CWnd派生类创建时,在调用CWnd::CreateEx()过程中,MFC都会安装AfxCbtFilterHook().这个Hook将拦截 ...
- requests保持cookies的问题
获取cookie,返回CookieJar对象:url = 'http://www.baidu.com'r = requests.get(url) r.cookies#将CookieJar转为字典: c ...
- Qt单元测试(QTestLib)
版权声明:若无来源注明,Techie亮博客文章均为原创. 转载请以链接形式标明本文标题和地址: 本文标题:Qt单元测试(QTestLib) 本文地址:http://techieliang.co ...
- 原生js移动端可拖动进度条插件
该插件最初的想法来自网上的一篇文章,直达链接:https://www.cnblogs.com/libin-1/p/6220056.html 笔者因为业务需要寻找到这个插件,然后拿来用之,发现各种不方便 ...
- DOS工具
winver 检查Windows版本wmimgmt.msc 打开windows管理体系结构wupdmgr windows更新程序wscript windows脚本宿主设置write 写字板w ...
- BZOJ 1076 奖励关(状压期望DP)
当前得分期望=(上一轮得分期望+这一轮得分)/m dp[i,j]:第i轮拿的物品方案为j的最优得分期望 如果我们正着去做,会出现从不合法状态(比如前i个根本无法达到j这种方案),所以从后向前推 如果当 ...
- poj 1273 && hdu 1532 Drainage Ditches (网络最大流)
Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 53640 Accepted: 2044 ...
- bzoj 1797: [Ahoi2009]Mincut 最小割 (网络流)
太神了直接看了hzwer的题解,有个新认识,一条路径上满流的一定是这条路径上所有边的最小值. type arr=record toward,next,cap,from:longint; end; co ...
- [HNOI2009]有趣的数列 卡特兰数
题面:[HNOI2009]有趣的数列 题解: 观察到题目其实就是要求从长为2n的序列中选n个放在集合a,剩下的放在集合b,使得集合a和集合b中可以一一对应的使a中的元素小于b. 2种想法(实质上是一样 ...