New to Telerik UI for ASP.NET MVCStart a free 30-day trial

Display Directory Name and File Size in Upload

Environment

ProductTelerik UI for ASP.NET MVC Upload
Progress Telerik UI for ASP.NET MVC versionCreated with the 2022.1.412 version

Description

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?

Solution

  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.
Index.cshtml
    @(Html.Kendo().Upload()
        .Name("files")
        .Async(a => a
            .Save("Directory_Upload_Chunk_Save", "Home")
            .Remove("Directory_Upload_Remove", "Home")
            .ChunkSize(11000)
        )
        .ShowFileList(false)
        .Directory(true)
        .DirectoryDrop(true)
        .Events(e=>e.Select("onSelect"))
        .Validation(validation =>
        {
            validation.MaxFileSize(20000000);
        })
    )

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

More ASP.NET MVC Upload Resources

See Also