<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<table>
<form id="uploadForm" enctype="multipart/form-data">
<input id="file" type="file" name="file"/>
<button id="upload" type="button">upload</button>
</form>
</table>
</body>
</html>
<script src="jquery.1.12.min.js"></script>
<script>
$("#upload").click(function(){
$.ajax({
url: 'upload.php',
type: 'POST',
cache: false,
data: new FormData($('#uploadForm')[0]),
processData: false,
contentType: false
}).done(function(res) {
alert(res)
}).fail(function(res) {});
})
</script>