i have a table with multiple rows , Each row has input file and some other text inputs , i want to pass this data to the JsonResult from jquery function , but i face the problem so i always get request files = 0
here is my code
function saveDocumentsData(researcherId) {
debugger;
var document = new Array();
documents = new Array();
$("#docsTable > tbody > tr").each(function () {
var row = $(this);
var id = row.find("span.id").html();
var docId = row.find("span.docId").html();
var docType = $("#docTypes" + id + " option:selected").val();
var docDate = ($("#date" + id).datepicker('getDate'));
var dFileUpload = $("#up" + id).get(0);
var dFiles = dFileUpload.files;
document =
{
"UpdateDate": thisDate, "IsActive": true, "UserId": userId,"JobResearcherId": researcherId,
'JobResearcherDocumentsId': docId, 'JobResearcherDocumentTypesId': docType
, 'DocumentRegisterDate': docDate.toISOString(), 'DocFiles': dFiles[0]
};
documents.push(document);
});
$.ajax({
url: "@Url.Action($"AddResearcherDocuments", $"JobResearcher")",
type: "POST",
contentType: 'application/json',
processData: false,
data: JSON.stringify({
researcherDocuments: documents
}),
success: function (data) {
}
});
}
all data passed truly but inputs files . Any advice