New to Telerik UI for ASP.NET MVC? Download free 30-day trial

Display Directory Name and File Size in Upload


Product Telerik UI for ASP.NET MVC Upload
Progress Telerik UI for ASP.NET MVC version Created with the 2022.1.412 version


How can I display the directory name and the total size of its content when working with the Telerik UI for ASP.NET MVC Upload?


  1. Hide the file list menu through the .ShowFileList() configuration method.
  2. Subscribe to the Select event.
  3. Get both the directory name and total file size in the Select event handler, and append them to the widget wrapper.
        .Async(a => a
            .Save("Directory_Upload_Chunk_Save", "Home")
            .Remove("Directory_Upload_Remove", "Home")
        .Validation(validation =>
        function onSelect(e) {
            var directoryName = "";
            if (e.files.length) {
                directoryName = e.files[0].rawFile.webkitRelativePath.split("/")[0]; //get the directory name

            var totalFileSize = 0;
            $.each(e.files, function (index, value) {
                totalFileSize += value.size; //sum up the total file size
            var upload = $("#files").data("kendoUpload"); //get the reference of the upload component
            upload.wrapper.append("<div class='k-file'><p class='k-file-name'>Uploaded directory: " + directoryName
            + "</p><p class='k-file-size'>Total file size: "+totalFileSize+" KB</p></div>"); //append the custom content

For the complete implementation of the suggested approach, refer to the following Telerik REPL example.

More ASP.NET MVC Upload Resources

See Also

In this article