Remove drag/drop upload

How do we remove drag drop upload functionaility in v21.1.38? 


I have tried AllowDragAndDrop=false but that does not work. I have also tried using the Created event and calling java:

function FileManager() {

            var fileObj = document.getElementById("file-controller").ej2_instances[0];

            fileObj.uploadObj.dropArea = null;

        }

But get "Cannot read properties of undefined (reading '0')


Thanks, Martin



2 Replies

EB Elis Brick May 29, 2024 05:43 AM UTC

To remove the drag-and-drop upload functionality in v21.1.38, try the following:

  • Ensure the AllowDragAndDrop property is set to false correctly.
  • Use the created event to modify the drop area.
Here's an updated approach:

function onFileManagerCreated() {

    var fileObj = document.getElementById("file-controller").ej2_instances[0];

    if (fileObj && fileObj.uploadObj) {

        fileObj.uploadObj.dropArea = null;

    } else {

        console.error("File Manager or Upload Object not initialized properly.");

    }

}


// Attach the function to the FileManager created event

document.getElementById("file-controller").addEventListener('created', onFileManagerCreated);


Make sure that the id "file-controller" is correct and that the script runs after the FileManager component is fully loaded.



SS Shereen Shajahan Syncfusion Team May 29, 2024 07:14 AM UTC

Hi Elis,

Thank you for the update. Please get back to us for assistance in the future.

Regards,

Shereen


Loader.
Up arrow icon