Need More Info
Last Updated: 19 Sep 2023 10:09 by ADMIN
n/a
Created on: 12 Sep 2023 16:57
Category: Kendo UI for jQuery
Type: Bug Report
0
Kendo Upload sometimes duplicates inserted files

When using Kendo's Upload component when you select a file/files to upload there is a 20% chance that it will upload the same file twice. We switched auto upload off to help, but when you delete one of the dupped files the upload button disappears causing you to delete both of them and then re-upload the file.

Upload Code -

 var w = $("#winFiles").data("kendoWindow");
                w.setOptions({
                    width: $(window).width() - 150,
                    height: $(window).height() - 150
                });
w.center().open();
                $("body").on("click", "#lnkShowUpload", function () { showWinUpload(associationId, typeId) });

 

function showWinUpload(associationId, typeId) {
var w = $("#winUpload").data("kendoWindow");
    $("#fileUpload").kendoUpload({
async: {
                        saveUrl: `/api/File/?typeId=${typeId}&associationId=${associationId}`,
                        autoUpload: false
                    },
                    validation: {
                        allowedExtensions: ["pdf", "jpg", "img", "png", "gif", "doc", "docx", "xls", "xlsx", "csv", "txt"]
                    }
});
                w.setOptions({
                    height: $(window).height() - 175
                });
w.center().open();
}


1 comment
ADMIN
Georgi Denchev
Posted on: 19 Sep 2023 10:09

Hello,

Thank you for the provided details.

It is possible that the Upload component is being initialized multiple times and this could lead to the described problem. Could you try making the following change and see if that makes a difference?

let upload = $("#fileUpload").data("kendoUpload");

if(!upload){
$("#fileUpload").kendoUpload({
 async: {
    saveUrl: `/api/File/?typeId=${typeId}&associationId=${associationId}`,
 },
 validation: {
    allowedExtensions: ["pdf", "jpg", "img", "png", "gif", "doc", "docx", "xls", "xlsx", "csv", "txt"]
 }
});
}

If this doesn't help, may I ask you to share a small Dojo sample where the problem can be reproduced?

Here's a Dojo with some of the basics configurations:

https://dojo.telerik.com/@gdenchev/IpUwIwIv 

Best Regards,
Georgi Denchev
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources