So, I understand that this is a rather old question, but I recently figured out how to do this reliably. While another answer here will necessarily display files, it really does not connect it to any of the events (in particular, to the βdeleteβ event). Also, instead of manually setting all this up, I decided that I would prefer Kendo to do all the real dirty work.
Note. This applies only if autosync is not set to download the file. If you use the automatic download function, you can find examples in the Kendo documentation: http://docs.kendoui.com/api/web/upload#configuration-files
In any case, let's say we have an input for the file that we contributed to the Kendo download:
<input id="files" name="files" type="file" multiple="multiple" />
$(document).ready(function () { var $upload = $("#files"); var allowMultiple = Boolean($upload.attr("multiple")); $upload.kendoUpload({ multiple: allowMultiple, showFileList: true, autoUpload: false }); }
Then we just need to get the file information in our jQuery. I like to get it stuck in JSON strings in hidden fields, but you can do it however you want.
Here is an example using Mvc HtmlHelpers and Newtonsoft JSON.NET (I do not use Razor, but you should get a general idea):
if (Model.Attachments.Count > 0) { var files = Model.Attachments.Select(x => new { name = x.FileName, extension = x.FileExtension, size = x.Size }); var filesJson = JsonConvert.SerializeObject(files); Html.Render(Html.Hidden("existing-files", filesJson)); }
Please note: the format there is incredibly important. We bind the structure of the JavaScript object expected by Kendo:
{ relatedInput : sourceInput, fileNames: [{
So then all that remains to be done is all together. Basically, we are going to recreate the onSelect function from the Kendo syncUploadModule internal code:
$(document).ready(function () {
And that is pretty much!