FileUpload 上传文件 详细参数设置 前后台代码

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 + "--
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值