html代码:
<div id="fileQueue"></div> <--进度展示-->
<div id="uploadify" class="attch-img-btn"> </div><--上传按钮-->
js代码
$(function(){
var houseId = '';
$("#uploadify").uploadify({
debug : false,
swf : '/gsym/resource/js/uploadify/uploadify.swf', //swf文件路径
method : 'get', // 提交方式
uploader : '/gsym/file/fileload', // 服务器端处理该上传请求的程序(servlet, struts2-Action)
preventCaching : true, // 加随机数到URL后,防止缓存
buttonCursor : 'hand', // 上传按钮Hover时的鼠标形状
//buttonImage: '/gsym/resource/images/atimg-up-bgad.png', // 按钮的背景图片,会覆盖文字
buttonText : '', //按钮上显示的文字,默认”SELECTFILES”
height : 40, // 单位 px
width : 60, // 单位 px
fileObjName : 'filedata', //文件对象名称, 即属性名
fileSizeLimit : 1000, // 文件大小限制, 1M
fileTypeDesc : 'any', //文件类型说明 any(*.*)
fileTypeExts : '*.*;*.txt', // 允许的文件类型,分号分隔
formData : {
'houseId' : houseId,
'path' : path
}, //指定上传文件附带的其他数据。也动态设置。可通过getParameter()获取
multi : true, // 多文件上传
progressData : 'percentage', // 进度显示, speed-上传速度,percentage-百分比
queueID : 'fileQueue', //上传队列的DOM元素的ID号
queueSizeLimit : 99, // 队列长度
removeCompleted : true, // 上传完成后是否删除队列中的对应元素
removeTimeout : 2, //上传完成后多少秒后删除队列中的进度条,
requeueErrors : true, // 上传失败后重新加入队列
uploadLimit : 20, // 最多上传文件数量
successTimeout : 30, //表示文件上传完成后等待服务器响应的时间。超过该时间,那么将认为上传成功。
// 在文件被移除出队列时触发
//onCancel : function(file) { alert( 'The file ' + file.name + ' was cancelled!' ); },
// 在调用cancel方法且传入参数’*’时触发
//onClearQueue : function (queueItemCount) { alert( queueItemCount + ' files were removed from the queue!' ); },
// 打开文件对话框 关闭时触发
onDialogClose : function(queueData) {
/*alert("选中文件数 :" + queueData.filesSelected + "--