/*企业认证上传*/
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] == ".jpeg" || postfix[0] == ".png" || postfix[0] == ".gif" || 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',
		secureuri: false,
		fileElementId: 'fileone' + num,
		dataType: 'json',
		success: function(data, status) {
			console.log(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", "");
}