In design, I have multi records with one file upload in tabular form.
in every ng-change of the file, I am getting the file and storing it into a global variable like below.
app.controller('AngController', function ($http, $scope) {
$scope.EqFiles = '';
$scope.UploadFiles = function (files) {
$scope.EqFiles = files;
};
on every 'Add' action (plus button) I am pulling all values into one array like below
$scope.SystemAccesories = [];
$scope.Add = function () {
var systemdetail = {};
systemdetail.SystemAcsId = 0;
systemdetail.AcsName = $scope.txtAccessoryName;
.
.
.
systemdetail.Remarks = $scope.txtSysRemarks;
if ($scope.EqFiles.length != 0) {
systemdetail.ManualFile = $scope.EqFiles;
systemdetail.IsManualFileAvailable = true;
}
else {
systemdetail.IsManualFileAvailable = false;
}
$scope.SystemAccesories.push(systemdetail);
};
at final I am sending it to the MVC controller's method
$http({
method: 'POST',
url: '/Equipment/UpdateEquipment',
data: { EquipmentAllFields: scope.SystemAccesories },
headers: { 'content-type': 'application/json' }
}).then(function (response) {
});
with the below parameters.
public class SystemAccessories
{
public int SystemAcsId { get; set; }
public string AcsName { get; set; }
.
.
.
public string Remarks { get; set; }
public Nullable<bool> IsManualFileAvailable { get; set; }
public HttpPostedFileBase ManualFile { get; set; }
}
on c# side getting all text values as expected but all 'ManualFile' parameters getting null values. so how to catch it then I can store with exact related data.
