Following is the JQuery
code that I'm using:
$('#btnVideoUpload').click(
function () {
var xhr = new XMLHttpRequest();
var fd = new FormData();
fd.append("AssociatedVideoFile", $('#AssociatedVideoFile')[0]);
console.log($('#AssociatedVideoFile')[0]);
xhr.open("POST", "/Admin/UploadVideo/", true);
xhr.send(fd);
xhr.addEventListener("load", function (event) {
alert(event.target.response);
}, false);
});
Here is my controller code:
[HttpPost]
public void UploadVideo(HttpPostedFileBase AssociatedVideoFile){
var fupVideoFile = AssociatedVideoFile;
//other code...
}
When I run this code, the value of AssociatedVideoFile
is always null. Can anyone help me with the issue and point out what I'm doing wrong?