Warn users about uploading folders not working and resolve #599 (#1181)

This commit is contained in:
Lance Pioch 2018-05-31 23:36:00 -04:00 committed by Dane Everitt
parent 6e6ce652b2
commit b7eed67f2f

View file

@ -61,6 +61,18 @@
event.preventDefault();
}, false);
window.foldersDetectedInDrag = function (event) {
var folderDetected = false;
var files = event.dataTransfer.files;
for (var i = 0, f; f = files[i]; i++) {
if (!f.type && f.size === 0) {
return true;
}
}
return folderDetected;
};
var dropCounter = 0;
$('#load_files').bind({
dragenter: function (event) {
@ -75,6 +87,15 @@
}
},
drop: function (event) {
if (window.foldersDetectedInDrag(event.originalEvent)) {
$.notify({
message: 'Folder uploads are not supported. Please use SFTP to upload whole directories.',
}, {
type: 'warning',
delay: 0
});
}
dropCounter = 0;
$(this).removeClass('hasFileHover');
}