我有一个包含多行的表,每行都有输入文件和一些其他文本输入,我想从jquery函数将这些数据传递给JsonResult,但我遇到问题所以我总是得到请求文件= 0
这是我的代码
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) {
}
});
}
所有数据都是真实传递但输入文件。任何建议