MyBB Community Forums

Full Version: Duplicate Attachments 1.8.27
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
The only one that actually handles the drag and drop upload is this:

Post.dropZone.on('drop', function (e) {
 e.preventDefault();
 $(this).removeClass('activated');
 var files = e.originalEvent.dataTransfer.files;
 Post.fileInput.prop('files', files).trigger('change');
});

The rest don't actually handle anything with the upload, but if you wanted to remove the functionality you'd need to remove all the bindings other than click (basically all the drag ones) so it doesn't update the UI when you try and drag.

I was looking into it, and the issue is this:

Post.fileInput.prop('files', files).trigger('change');

A callback is bound to the change event:

Post.fileInput.on('change', Post.addAttachments);

So on change, it should run the addAttachments function. In Chrome is runs it once, but in Safari it runs it twice.

[attachment=44774][attachment=44775]

If I remove the line that manually triggers the change, it doesn't run addAttachments at all. So I'm not sure why it would be triggering the change event twice in Safari.
Thank you Matt. At least you've verified there is anomalous behavior.

I have not gotten reports of problems with other browsers. Firefox, for example, works as expected, including when running in OSX, which is the most common environment where Safari drag and drop would occur. Everywhere else would be a click or tap to open a dialog which is problem-free.

This is all way above my programming skills. A bug report has been submitted.
I think if anything it's a bug in Safari firing a change event twice, I'm not too sure what we'd be able to do about it.
Can anyone confirm if this bug has been fixed? My forum revolves around attachments and a huge percentage are Safari users. Unless this has been fixed, I can't use the most recent update because my site will be crippled.

If not, is there any way of doing away with the drag-and-drop uploader? This is a broken core feature for anyone using desktop Safari.
I've not seen anyone report this issue for some time, and can't reproduce it in Safari any more. I'm pretty sure it was a Safari bug in the first place, and seems to be fixed now.
Awesome! I'm going to doublecheck on my end as well -- thanks Matt.
Pages: 1 2