
4 Answers, 1 is accepted

my code:
@using Kendo.Mvc.UI
<script id="fileTemplate" type="text/x-kendo-template">
<span class='k-progress'></span>
<div class='file-wrapper'>
Photo type:
<select>
</select>
<br />
<img id="preview">
</div>
</script>
<div class="demo-section k-content">
@(Html.Kendo().Upload()
.Name("multiPhotoUpload")
.TemplateId("fileTemplate")
.Async(a => a
.Save("Save", "PhotoUploadDemo")
.AutoUpload(false)
)
.Events(events => events
.Select("onSelect")
.Success("onSuccess")
.Upload("onUpload")
)
)
</div>
<script type="text/javascript">
function onSelect(e) {
// add image preiew and drop down list cotents here
}
function onUpload(e) {
// this is triggered for each file, not for all files.
// how can I check user selected a different photo type from the drop down lists for each photo?
}
</script>
By default the upload event is fired when one or more files are about to be uploaded. You can use the e.files object top check the name, extension or size of the file.
Regards,
Plamen
Progress Telerik

Hi, Plamen,
Thank you for your reply. The problem is when async.batch is set to false, onUpload() is triggered for each photo (many times), not for all photos (once). That means, e.files.length is always 1. But if I set async.batch to true, I wan't able to display preview (it only shows the last photo) and drop down list for each photo.
Thanks.
Yes, you are right when batch is set to true the Upload event is triggered only once but you have the e.files collections of all selected file and it can be used to check the name, extension or size of the file.
Regards,
Plamen
Progress Telerik