1.html代码
<input type="file" name="myupdate" id="myupdate">
2.javascript代码
var fd = new FormData();
fd.append("myupdate", $('#myupdate')[0].files[0]);
$.ajax({
url: posturl,
type: 'post',
processData: false,
contentType: false,
data: fd,
success: function (res) {
//do something
}
});