Edit this page

Upload in Synchronous Mode File Type Validation


Product Progress Kendo UI Upload
Operating System All
Browser All
Preferred Language JavaScript


How can I validate the file selected in the Upload by file type (extension), when synchronous mode is used?


When the Upload is configured to use synchronous mode the file type validation can be done with the Kendo UI Validator as demonstrated below.

    <form method="post" action="http://demos.telerik.com/kendo-ui/upload/submit">
        <div class="demo-section k-content">
            <input name="files" id="files" type="file" aria-label="files" />
            <p style="padding-top: 1em; text-align: right">
                <button type="submit" class="k-button k-primary">Submit</button>
        $(document).ready(function() {
                validation: {
                    allowedExtensions: [".jpg"],

        var validatable = $("form").kendoValidator({
            rules: {
                upload: function(input) {
                    if (input[0].type == "file") {
                        return (input.closest(".k-upload").find(".k-file").length > 0 && input.closest(".k-upload").find(".k-file-invalid").length == 0);
                    return true;
    .k-upload-button .k-invalid-msg {
        display: none !important;
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article