How do I validate the content of a file on the upload event? I want to read the contents of an excel file and get a distinct list from one of the columns. Thank you.
Regards,
Jerome
2 Answers, 1 is accepted
0
Anton Mironov
Telerik team
answered on 12 Dec 2022, 08:02 AM
Hello Jerome,
Thank you for contacting the team.
The Upload supports three types of validation:
By file extension.
By maximum file size.
By minimum file size.
The following article provides further information about the Telerik UI Upload Validation:
I am aware of the upload validations. However, I want to validate the file contents.
Should I use the Select event with a function? If so, how would I open the file and read its contents?
I thought by using the upload event and creating a byte array and copying the contents to a fileStream - but it looks like that only works for .txt files.
Thank you.
Regards,
Jerome
Anton Mironov
Telerik team
commented on 15 Dec 2022, 08:40 AM
Hi Jerome,
Thank you for the additional details provided.
The Telerik UI Components stands for visualizing the data provided. In order to upload, open, and read the Excel content, I would recommend using the Telerik UI Spreadsheet Component.
The following demo is representing the server import and export functionality: