<!doctype html>
<html>
<head>
<meta charset=utf-8/>
<tilte>uploadfile</title>
<script>
function uploadfile(){
var formdata = new formdata();
var files = document.getelementbyid('file').files;
var file = files[0];
formdata.append('file',file);
var xhr = new xmlhttprequest();
xhr.open('post','index.html',true);
xhr.onload = function(e){
if(this.status == 200){
document.getelementbyid(resulte).innerhtml = this.response;
}
};
xhr.send(formdata);
}
</script>
</head>
<body>
<form id=form1 enctype=multipart/form-data>
<input type=file id=file name=file><br/>
<input type=button value=upload onclick=uploadfile();>
</form>
<output id=result></output>
</body>
</html>