3

i am using Kendo upload feature. While have set uploadmultiple option to true and autoupload to false.

If i select 2 files and click on Upload Button, the Save API function is called 2 times, once for each file.

Is it possible to call this function only once with both attachments passed in the parameter ?

<input name="attachments" type="file" id="attachments" />
<script type="text/javascript">
    $(document).ready(function () {
        $("#attachments").kendoUpload({
            async: {
                saveUrl: '@Url.Action("Save", "AppConfig")',
                autoUpload: false,
            allowmultiple: true
            }
        });
});
</script>



[HttpPost]
public ActionResult Save(IEnumerable<HttpPostedFileBase> attachments)
{

    if (SaveFiles(attachments)
    {
        return Content("");
    }
    else
    {
        return Content("error");
    }

}
user3784398
  • 33
  • 1
  • 3

1 Answers1

1

By default selected files will be uploaded in separate requests.

If you want to download them once you need to set the async.batch option to true:

$("#attachments").kendoUpload({
    async: {
        saveUrl: '@Url.Action("Save", "AppConfig")',
        autoUpload: false,
        allowmultiple: true,
        batch: true
    }
});
nemesv
  • 138,284
  • 16
  • 416
  • 359