var pic = []; var upload = []; function loadUpload(i,e,key,upload,assets) { var value = e.attr('v'); if(typeof(upload[value]) != "undefined") { return; } upload[value] = true; e.uploadify({ 'formData' : {'key' : key}, 'swf' : assets + 'uploadify.swf', 'buttonText' : '选择文件', 'uploader' : upload, 'cancelImg' : assets + 'upload/img/fyuploadify-cancel.png', 'onUploadSuccess':function(file,data,response) { //console.info(data); var data = eval('('+data+')'); if(data.status) { var mul = e.attr('mul'); if(mul == 'yes') { if(pic.length <= 0 && $("#" + value).val()) { pic = $("#" + value).val().split(','); } var m = $('.' +value+'_mul'); var i = m.find('img').eq(pic.length); if(i.length) { i.attr('src', data.url); } else { m.append('点此删除'); } pic.push(data.url); //console.info(pic); $("#" + value).val(pic.join(',')); } else { $("#"+file.id).find('.data').html('上传完毕'); $('#'+value).val(data.url); $('#show_'+value).attr('src',data.url).show(); } } else { $("#"+file.id).find('.data').html(""+data.message+""); return false; } } }); } if(jQuery.browser.msie){ SWFUpload.prototype.getFlashHTML = function () { return ['', '', '', '', '', '', '', ''].join(""); } } function picDel(p,e,v) { if(pic.length <= 0 && $("#" + v).val()) { pic = $("#" + v).val().split(','); } e.remove(); pic.remove(p); //console.info(pic); $("#" + v).val(pic.join(',')); }