kendo ui validate and upload images files

kendo ui validate and upload images files

Hi everyone, I am going to share the code sample to validate and upload the image files using kendo ui with jQuery. The code details as give below.

Table of Content

1. The cshtml razor view code.
2. jQuery and JavaScript code
3. MVC 5 controller code

The razor view

<div class="form-group">
   <label for="bio" class="control-label col-sm-2">Kendo ui Upload image file</label>
   <div class="col-sm-10">
           <input name="files" id="files" type="file" />                                                

jQuery and JavaScript

<script type="text/javascript">
$(function () {
    //This used for check and validate image file.
    var onSelect = function (evn) {
        if (evn !== undefined && evn !== null) {
            $.each(evn.files, function (key, val) {
                if (val !== undefined) {
                    filepath =;
                    var isValid = val.extension == ".JPG"
                                 || val.extension == ".JPEG"
                                 || val.extension == ".PNG"
                                 || val.extension == ".jpg"
                                 || val.extension == ".jpeg"
                                 || val.extension == ".png";                         

                    if (!isValid) {
                        showMSG($("#msg"), 'Please select only image files.');

    var onComplete = function () {

        async: {
            saveUrl: '@Url.Action("Submit", "UserProfile")',
            autoUpload: true
        select: onSelect,
        complete : onComplete



Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - and
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like Powered by Blogger.
ASK Questions