html
<form id="uploadForm">
<input type="file" style="width:100%;display:inline" id="file" name="file">
</form>
js
var formData = new FormData($( "#uploadForm" )[0]);
$.ajax({url: '/xxxxx' ,
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
success: function (data) {
alert("上传成功")
},error: function (data) {
}
});