HTML :
<input id="myId" type="text">
<input id="newFile" type="file" name="newFile" >
<input type="button" onclick="sendData()" value="Send" >
JQuery:
function sendData() {
var id = $("#myId").val();
var myFile = $("#newFile").val();
$.post("test.php", { id: id , file: myFile },function (data) {
console.log(data);
}, "json").fail(function (data) {
alert("error");
});
}
this code post id value and the file name !!
i want to post file ..