I have a grid in which column allows users to attach 1 or more files for a given row. The users can add attachments one at a time.
After they have completed adding files, i would like to read the list of files from the kendoUpload control and upload them along with other data in the grid in one shot.
The code below however always returns only one file even if there is more than one that the user added. Any ideas why this is?
var
fileData =
new
FormData();
//prefix files with assumptionCode to map them to appropriate record in controller
$.each($(
"input[type=file]"
),
function
(i, obj) {
debugger;
var
id = $(
this
).closest(
'form'
).attr(
'id'
);
$.each(obj.files,
function
(j, file) {
fileId = id +
'_'
+ file.name
fileData.append(fileId, file);
})
});
For the the column that contains the kendoUpload controls, i am using a custom template which returns the following:
frm =
"<form method='post' action='#' enctype = 'multipart/form-data' id='"
+ data.Code +
"' >"
+
"<input class='attachments' tabindex='-1' name='files[]' type='file' "
+
"id='"
+ data.Code +
"' /></form>"
return
frm
Any idea why this is happening and how to resolve