0

I am using Kendo UI upload. It works fine when using the select button but does not work when drag is used in the HttPostedFile; my viewModel property stays null.

I have made sure the property name and the Kendo Upload component names are same. Below is my JavaScript code:

$("#AvatarImageFile").kendoUpload({
            async: {
                autoUpload: true,
                saveUrl: "URL for temp"
            },
            multiple: false,
            showFileList: false,
            select: function (e) {
                var fileReader = new FileReader();
                fileReader.onload = function (event) {
                    var imagePath = event.target.result;
                    $("#uploadedAvatarImage").attr('src', imagePath);
                    $(".k-upload .k-upload-status-total").hide();
                }
                fileReader.readAsDataURL(e.files[0].rawFile);
                console.log(e.files[0]);
            }
        });.

I have used enctype = "multipart/form-data" as part of the header.

cf-
  • 8,598
  • 9
  • 36
  • 58
maxspan
  • 13,326
  • 15
  • 75
  • 104

1 Answers1

0

Alright I Got the answer. Basically you need to make the async false.

async: {
            autoUpload: false,
            saveUrl:'@Url.Action("SaveImage", "User", new { userId = Model.UserID })'
        },
maxspan
  • 13,326
  • 15
  • 75
  • 104