I need to upload files and some other data, for which I used bellow code
HTML:
<intut type='file' id='file1'>
<intut type='file' id='file2'>
javascript:
var data = new FormData(),
categories = ['node.js','redis'],
roles = ['admin','HR'];
data.Append ($('#file1').Files[0].name, $('#file1').Files[0]);
data.Append ($('#file2').Files[0].name, $('#file2').Files[0]);
data.Append ('category', 'categories');
data.Append ('role', 'roles');
$.ajax({
url: baseaddress + 'DocRepo/GetAdminUploadData',
type: 'Post',
data: data,
cache: false,
dataType: 'json',
async: false,
contentType: false,
processData: false,
success: function (data) {
},
error: function (data) {
}
});
From here I have an action method in my MVC Controller (not webapi) GetAdminUploadData
where I need to collect all data(files, category and roles) how can do it.