日期:2014-05-18 浏览次数:20416 次
<script src="/jquery/jQuery.js" type="text/javascript"></script> <script src="/uploadify/jquery.uploadify.js" type="text/javascript"></script> <script type="text/javascript"> var myArray=new Array(); $(document).ready(function(){ regUpload(); }); function regUpload() {//在这里我列出了常用的参数和注释,更多的请直接看jquery.uploadify.js $("#uploadify").uploadify({ swf: '/uploadify/uploadify.swf',//上传的Flash,不用管,路径对就行 uploader:'/UpDownloadHandler.ashx?GetFunction=UploadFile',//Post文件到指定的处理文件 auto : true, // buttonClass:'JQButton',//浏览按钮的class buttonText: '上传文件',//浏览按钮的Text cancelImage: '/uploadify/uploadify-cancel.png',//取消按钮的图片地址 fileTypeDesc: '*.doc;*.docx;*.xls;*.pdf;*.jpg;*.gif;*.txt',//需过滤文件类型 fileTypeExts: '*.doc;*.docx;*.xls;*.pdf;*.jpg;*.gif;*.txt',//需过滤文件类型的提示 height: 30,//浏览按钮高 width:89,//浏览按钮宽 fileSizeLimit:0, //上传文件的大小限制 0无限制 单位:KB multi: true,//是否允许多文件上传 uploadLimit: 3,//同时上传多小个文件 queueSizeLimit: 3,//队列允许的文件总数 removeCompleted : false,//当上传成功后是否将该Item删除 removeTimeout:0,//当上传成功后删除Item时间 onSelect: function(file){},//选择文件时触发事件 onSelectError: function(file,errorCode,errorMsg){},//选择文件有误触发事件 onUploadComplete: function(file){},//上传成功触发事件 onUploadError: function(file,errorCode,errorMsg){},//上传失败触发事件 onUploadProgress: function(file,fileBytesLoaded,fileTotalBytes){},//上传中触发事件 onUploadStart: function(file){},//上传开始触发事件 onUploadSuccess: function(event, response, status){AddDocItem($.parseJSON(response));} //当单个文件上传成功后激发的事件 }); } function AddDocItem(objUploadDocumentItem,cc) { _tbDocItems = $('#tbDocItems'); if(_tbDocItems.css("display")=="none") { _tbDocItems.css("display","block"); } _tbodyDocItems = $('#tbodyDocItems'); controlID = objUploadDocumentItem.DocMuid.replace(/-/g, "").replace(".",""); //<a style='cursor:pointer;' href='/UpDownloadHandler.ashx?GetFunction=DownloadFile&DocMuid="+objUploadDocumentItem.DocMuid+"' >下载</a> 下载链接 _tbodyDocItems.append("<tr id='tr"+controlID+"'><td id='td"+controlID+"' class='upload_id'><img src='/uploadify/attach.png' border=0></td><td class='upload_name'>文件名:<a style='cursor:pointer;' href='/A_UpLoadFile/upload_file/"+objUploadDocumentItem.DocMuid+"' target='_blank'>"+objUploadDocumentItem.DocMuid+"</a></td><td class='upload_del'><a style='cursor:pointer; text-decoration:none;' href='#' onclick='Javascript:DeleteDocument(\""+objUploadDocumentItem.DocMuid+"\")'><img src='/uploadify/uploadify-cancel.png' border=0></a><input type='hidden' value='"+objUploadDocumentItem.DocMuid+"' name='DocMuid' /></td></tr>"); //$('#td'+controlID).html(_tbodyDocItems.attr('rows').length); } function DeleteDocument(MUID) { //$("#uploadify"+MUID).remove(); //$('#uploadify').uploadifySettings('queueSizeLimit', 0); //$("#uploadify").uploadifyCancel(MUID);