File upload not working using knockout js. I have tried with below code but not working. Please mention where I am doing wrong.
This is my file control and button. I am
function ()
{
var files = $("#FileName").get(0).files;
var data = new FormData();
for (var x = 0; x < files.length; x++) {
data.append("file" + x, files[x]);
}
$.ajax({
type: "POST",
url: '/api/Controller' + '/?id=' + id ),
contentType: false,
processData: false,
data: data,
success: function (result) {},
error: function (xhr, status, p3, p4) {}
});
}