uploadify上传文件插件动态传参数到服务器

var progressId="";
var isDown  ="";
var fileType="";
var projectId="";


function uploadFile(){

progressId=$("#progressId").val();
projectId =$("#projectId").val();
isDown    =$("#isDown").val();
fileType  =$("#fileType").val();
//调用uploadify上传文件插件
$("#file_upload").uploadify("upload","*");
}




/*uploadify上传文件插件*/


$(function() {  
 $("#file_upload").uploadify({ 
  'auto':false,       //是否允许自动上传
  'swf' : 'plug-in/uploadify/uploadify.swf?var='
           +(new Date()).getTime(), //引入flash  
  'buttonText':'选择文件',     //设置button文字 
  'simUploadLimit' : 1,       // 允许同时上传的个数 默认值:1
  'removeCompleted': true,//是否移除掉队列中已经完成上传的文件。false为不移除
  'removeTimeout': 3,//设置上传完成后删除掉文件的延迟时间,默认为3秒。
  'width ':'50',      //按钮宽度
  'method':'PSOT',   //提交方式
  'wmode'          : 'transparent' , 
  'preventCaching':'true',   //防止浏览器缓存 
  'fileObjName' : 'myFile',   //文件对象名称,用于后台获取文件对象时使用
 /* 'formData':{}, //传静态参数 
*/   'queueID': 'test',  //显示在某个div的位置  custom-queue div的id   
  'uploader' : 'projectProgressController.do?uploadFile' ,    //提交后台方法路径
  'removeTimeout':1,
  'onUploadStart' : function(file){
                   var element = {};
                   element.progressId = progressId;
                   element.isDown = isDown;
                   element.fileType = fileType;
                   $('#file_upload').uploadify('settings','formData',element);
                       },         //这个方法可以传动态参数
  'onUploadSuccess':function(file, data, response){  
  /*    var Data = eval('('+data+')');
             alert(file.name+"上传"+Data.result); */
  alert("添加成功");
  window.location.href =gv_BasePath+"/projectProgressController.do?go2CustomerProgressList&projectId="+projectId;
  cancel();
         },
         
       onError: function(event, queueID, file)   
            {    
             alert(file.name + " 上传失败");    
            },
           'onQueueComplete':function(stats) {  
//版本不一样方法也存在差异
        /*   alert("成功上传的文件数:" + stats.uploadsSuccessful + " =上传出错的文件数:" +stats.uploadsErrored + " -上传的文件总大小:" + stats.uploadSize); */
    return false;
        },
 }); 
 
 });






function cancel()


{
parentDialog.close();


}










评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值