上传文件插件

$.ajaxFileUpload({
url: urls.fileUploadUrl,//用于文件上传的服务器端请求地址
secureuri: false,//一般设置为false
type: 'post',
async: false,
dataType: 'json', //服务器返回的格式,可以是json或xml等
fileElementId: 'file',//文件上传空间的id属性 <input type="file" id="file" name="file" />
success: function (data) {//服务器成功响应处理函数
console.log("uploadTemplate--->data:", data);

},
error: function (data, status, e) {//服务器响应失败处理函数
$.xcConfirm("服务器响失败", $.xcConfirm.typeEnum.info);
// $("#fileButton").html("上传失败").css("color","red")
}
});
原文地址:https://www.cnblogs.com/liuhao-web/p/9469901.html