Hi,
I want to pass an array to the controller in MVC3 using the upload widget from kendo, here my code :
$("#uploadFiles").kendoUpload({
showFileList: false,
localization: {
"select": "Browse new"
},
select: SelectionCompleted,
async: {
autoUpload: false,
saveUrl: "/MediaManager/UploadFile/"
},
upload: function (e) {
var files = [
{
Title: 'Test',
FileName: 'MyFile',
Group: 'MyGroup',
Color: 'MyColor'
},
{
Title: 'Test2',
FileName: 'MyFile2',
Group: 'MyGroup2',
Color: 'MyColor2'
}
];
e.data = { files: files };
}
});
And here my model related to this JSON object :
public class FileUpload
{
public string Title { get; set; }
public string FileName { get; set; }
public string Group { get; set; }
public string Color { get; set; }
}
And here my code in the controller :
public ActionResult UploadFile(IEnumerable<HttpPostedFileBase> uploadFiles, IEnumerable<FileUpload> files) {}
The problem the array is empty.... What I'm doing wrong ?
Thank you
I want to pass an array to the controller in MVC3 using the upload widget from kendo, here my code :
$("#uploadFiles").kendoUpload({
showFileList: false,
localization: {
"select": "Browse new"
},
select: SelectionCompleted,
async: {
autoUpload: false,
saveUrl: "/MediaManager/UploadFile/"
},
upload: function (e) {
var files = [
{
Title: 'Test',
FileName: 'MyFile',
Group: 'MyGroup',
Color: 'MyColor'
},
{
Title: 'Test2',
FileName: 'MyFile2',
Group: 'MyGroup2',
Color: 'MyColor2'
}
];
e.data = { files: files };
}
});
And here my model related to this JSON object :
public class FileUpload
{
public string Title { get; set; }
public string FileName { get; set; }
public string Group { get; set; }
public string Color { get; set; }
}
And here my code in the controller :
public ActionResult UploadFile(IEnumerable<HttpPostedFileBase> uploadFiles, IEnumerable<FileUpload> files) {}
The problem the array is empty.... What I'm doing wrong ?
Thank you