Clear uploaded selected file from list

2 posts, 0 answers
  1. Vibhu
    Vibhu avatar
    1 posts
    Member since:
    Aug 2015

    Posted 05 Aug 2015 Link to this post

    I want to delete the selected uploaded file from the list on some condition.

    Actually I want to allow only PDF files to be uploaded. As soon as I upload I am able to track the file extension and I am able to popup a message that this file is not valid but that file is uploaded and shows RED marked in the uploaded file list on top. I want that file should be removed from the list at that time itself.

    Please help me out.


  2. Ivan Danchev
    Ivan Danchev avatar
    788 posts

    Posted 10 Aug 2015 Link to this post


    You can use the highlighted code below to delete the row with the file not uploaded due to an invalid extension:
    function OnClientValidationFailed(sender, args) {
        var fileExtention = args.get_fileName().substring(args.get_fileName().lastIndexOf('.') + 1, args.get_fileName().length);
        if (args.get_fileName().lastIndexOf('.') != -1) {
            //this checks if the extension is correct
            if (sender.get_allowedFileExtensions().indexOf(fileExtention) == -1) {
                alert("Wrong file type!");
                var row = args.get_row();
            else {
                alert("Wrong file size!");
        else {
            alert("not correct extension!");

    Ivan Danchev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Telerik UI for ASP.NET Core is out
Back to Top