Closed StefanRitchie closed 5 years ago
Hi Stefan,
Apologies, the events aren't as clear as they should be and may see some refactoring/better documentation soon. At the time that the 'dnd-upload:initialize'
event is triggered the uploads are not yet in the queue. It is more for overriding the default UI when an file is added.
We might add some more callbacks in the future to make this clearer but for now you should be able to get the functionality you're looking for by listening for the 'drop'
event instead.
document.addEventListener('drop', function (event) {
if(!event.target.closest('.asdndzone')) { return; }
console.log('This item was dropped on the box, or selected from dialog:');
TriggerProcessUploadQueue(form[0]);
});
Thank you very much for your help! I'll close this issue as my needs have been satisfied 👍
@MatrixStefan Did you get it working? Is every file uploading separately upon dropping it into the dropzone? Could you kindly provide the code and a short explanation of what needs to be done? It would be much appreciated!
Hi,
I'm trying to trigger file uploads as soon as they're dropped into the dndzone, and I'm just not succeeding. I'm hoping you can help. I'm sure I'm just misunderstanding something. Here's my code:
When I step through the code in Chrome Dev Tools I find that the file is present in the detail attribute of event (demonstrated by
console.log(event.detail)
) but at the below block of code inujs.js
, thenextUpload.current_uploaders.length
is equal to 0:I can confirm the
form
being passed toUploadQueueProcessor
is the correct form DOM element.I'm certain I must be overlooking something obvious, as it all seems to tie together nicely!