mardi 1 décembre 2015

Async file upload in MVC using kendoUpload

I am using file uploader with MVC.

Following is my code :

<div class="demo-section k-content">
<input name="files" id="files" type="file" />
</div>


<script>
$(document).ready(function () {
            var data = JSON.stringify({
            'ReportID': '@(Model.ReportID)',
        });

    $("#files").kendoUpload({
        async: {
            saveUrl: '@Url.Action("save", "UserPage")',

            //removeUrl: "remove",
            autoUpload: true,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            data: data,
        }//,
    });
});

on ActionResult I am using following code :

string fileName = Path.GetFileName(files.FileName);
fileName = model.ReportID + "s" + Guid.NewGuid() + extension;

Everything is working fine except the value of model.ReportID its returning NULL every time.

I am missing something here?

Aucun commentaire:

Enregistrer un commentaire