var formData = new FormData();
formData.append("file",$("#id")[0].files[0]);
var type = $('#type').val()
var user = $('#fuser').val()
formData.append("type",type)
formData.append("user",user)
$.ajax({
url: baseURL+"url",
data: formData,
type: "Post",
dataType: "formData",
cache: false,//上传文件无需缓存
processData: false,//用于对data参数进行序列化处理 这里必须false
contentType: false, //必须
success: function (data) {
},
})
}
网友评论