Customize Upload message when file type is not supported

4 posts, 0 answers
  1. Raphael
    Raphael avatar
    2 posts
    Member since:
    Aug 2019

    Posted 20 Oct 2020 Link to this post

    Is there a way to customize Upload's component error message when type of file that's submitted isn't allowed?

    Key for the message is upload.invalidFileExtension, but I couldn't find a way to change it.

  2. Stefan
    Admin
    Stefan avatar
    3034 posts

    Posted 21 Oct 2020 Link to this post

    Hello, Raphael,

    This can be done by using the LocalizationProvider and passing the required key-value pair in the JSON:

    https://www.telerik.com/kendo-react-ui/components/upload/globalization/

    I made an example that modifies the invalid file message:

    https://stackblitz.com/edit/react-ppmnhw?file=app%2Fbg.json

    I hope this is helpful.

    Regards,
    Stefan
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

  3. Raphael
    Raphael avatar
    2 posts
    Member since:
    Aug 2019

    Posted 21 Oct 2020 in reply to Stefan Link to this post

    Hi Stefan,

    Thanks for the response. I've encountered another problem, I want to have a different custom message in different components, eg. on one Upload component it should be "Type not allowed, please use .xlsx" and on another Upload component it should be "Type not allowed, please use .pdf"

    Would that be possbile?
    Thanks.

  4. Stefan
    Admin
    Stefan avatar
    3034 posts

    Posted 21 Oct 2020 Link to this post

    Hello, Raphael,

    This could be achieved by using two different LocalizationProviders with different message collections.

    Regards,
    Stefan
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Back to Top