/*企业认证上传*/ function uploadFun(_this, num) { var fileval = $(_this).val(); var reg = /[^\\\/]*[\\\/]+/g;      var name = fileval.replace(reg, '');       var postfix = /\.[^\.]+/.exec(name);       var filename = name.substr(0, postfix['index']); console.log(postfix[0]); if(postfix[0] == ".jpg" || postfix[0] == ".JPG" || postfix[0] == ".jpeg" || postfix[0] == ".JPEG" || postfix[0] == ".png" || postfix[0] == ".PNG" || postfix[0] == ".gif" || postfix[0] == ".GIF" || postfix[0] == ".pdf" || postfix[0] == ".PDF") { if(fileval != "") { $(_this).parents(".upFront").addClass("displayNone"); $(_this).parents(".uploadlogo").find(".upBack").removeClass("displayNone"); $(_this).parents(".uploadlogo").find(".upBack span").html(filename); ajaxFileUpload(num); } } else { $.MsgBox.Alert('提示', '请您上传正确的文件格式'); } } /*上传文件生成cacheKey码*/ function ajaxFileUpload(num) { $.ajaxFileUpload({ url: '/ajax/cachedFileUpload?text=1', secureuri: false, fileElementId: 'fileone' + num, type: "POST", dataType:"text/html", success: function(data, status) { var $data = JSON.parse(data); if($data.success) { $("#fileone" + num).attr("data-id", $data.data[0].cacheKey); } } }) } /*删除文件*/ function deluploadFun(_this, numt) { $(_this).parent().addClass("displayNone"); $(_this).parents(".uploadlogo").find(".upFront").removeClass("displayNone"); $("#fileone" + numt).attr("data-id", ""); }