New to Telerik UI for ASP.NET Core? Start a free 30-day trial
Adding Image Previews before Uploading Files in the Upload
Environment
Product | Telerik UI for ASP.NET Core Upload |
Progress Telerik UI for ASP.NET Core version | Created 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
- Create a function that executes the logic for adding an image preview upon selecting a file.
- To handle the file selection, subscribe to the
Select
event. - 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.