87,993
社区成员
发帖
与我相关
我的任务
分享var form = document.form[0];
var xhr = new XMLHttpRequest();
xhr.open("POST",form.action)
xhr.setHeader("content-type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = functio(){
if(xhr.readyState === 4 && xhr.status === 200){
//
alert("上传成功");
}else{
//
alert("上传失败")
}
}
var file = xhr.formData(form.file[0]);
xhr.send(file);