This is a migrated thread and some comments may be shown as answers.

Async (AutoUpload Off): Attach metadata per file uploaded

1 Answer 77 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 18 Jan 2014, 03:24 AM
I have my upload set to be async with the autoupload off.  I have created a list template which adds a dropdown to each of the files to be uploaded.  How can I on upload reference the dropdown for each of the corresponding file uploads and pass that dropdown's value as metadata along with the file.  I know how to attach meta data, but I don't know how to get the current file's, that is being uploaded, container so I can get the correct dropdown value to attach to the metadata.  I have read that the files can upload out of order, so I can't depend on the files being uploaded in a perfect order.  

Thanks,
Joe

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimiter Madjarov
Telerik team
answered on 21 Jan 2014, 11:52 AM
Hi Joe,

You could use the name parameter, that is passed to the template to identify the file, that is currently being uploaded and get it's list item. For example in the default template, the name is used as a title attribute of a span element. Here is a sample approach:
function onUpload(e) {
    var name = e.files[0].name;
    var listItem = this.wrapper.find("[title='" + name + "']").closest("li.k-file");
    var ddlValue = listItem.find("[data-role='dropdownlist']").data("kendoDropDownList").value();
 
    e.data = {
        value: ddlValue
    }
}

I hope this information helps. Have a great day!

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Upload
Asked by
Joe
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or