I am using kendo-upload an I am looking for the option to view the file after the user uploads it, I want to be able to click on the file name and the file will then be displayed/ downloaded.
Is there any way to get this behaviour?
5 Answers, 1 is accepted
A possible way to achieve this is to bind the uploaded files via ngModel - this way there will be no need to download the file after it has been uploaded in order to display it. Displaying the file could be achieved via file reader on the client side. Here is an example of this in action, in which I used the following resources of the documentation:
File templates - https://www.telerik.com/kendo-angular-ui/components/upload/templates/
Model binding - https://www.telerik.com/kendo-angular-ui/components/upload/model-binding/
Thank you for you reply.
Your example only works for a .jpg file... I need to be able to upload all file types (and display them), can you advice how to do it?
Thanks in advance
The FileReader could be used to read the content of any file type by using the appropriate method
but displaying the content would be strictly specific and will most probably require a third party library to achieve it.
I am wondering if there is another way to accomplish this without overriding / changing the telerik template?
If that's not possible can we have the html for telerik template so I can use it in my code and just add the click event ?
Indeed, some custom implementation will be needed in order to achieve the desired behavior. You can check the source code of any Kendo Ui for Angular package by following the instructions on the following page: