html5 上传文件

<input id="file_info" type="file" />

var fd = new FormData(document.getElementById("file_info"));
fd.append("CustomField", "This is some extra data");
$.ajax({
  url: "stash.php",
  type: "POST",
  data: fd,
  processData: false,  // tell jQuery not to process the data
  contentType: false   // tell jQuery not to set contentType
});

你可能感兴趣的:(jquery,Ajax,html5)