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

Adding Image Previews before Uploading Files in the Upload

Environment

ProductTelerik UI for ASP.NET Core Upload
Progress Telerik UI for ASP.NET Core versionCreated with the 2022.2.802 version

Description

How can I add an image preview that appears before the user uploads a file when working with the Telerik UI for ASP.NET Core Upload?

Solution

  1. Create a function that executes the logic for adding an image preview upon selecting a file.
  2. To handle the file selection, subscribe to the Select event.
  3. Within the handler, call the previously created function for each file entry and pass the Upload's wrapper.
Index.cshtml
    @(Html.Kendo().Upload()
        .Name("files")
        .Events(e => e.Select("onSelect"))
        .Async(a => a
            .Save("Async_Save", "Upload")
            .Remove("Async_Remove", "Upload")
            .AutoUpload(false)
        )
    )

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

More ASP.NET Core Upload Resources

See Also