Pages

Friday, June 6, 2014

Kendo file upload to check file type at client side

<script type="text/javascript">
    function onUpload(e) {
        // Array with information about the uploaded files
        var files = e.files;

        // Check the extension of each file and abort the upload if it is not .jpg
        $.each(files, function() {
            if (this.extension != ".jpg") {
                alert("Only .jpg files can be uploaded")
                e.preventDefault();
                return false;
            }
        });
    }
</script>






No comments:

Post a Comment