Ability to select multiple files to upload (#275)

pull/1/head
yflory 6 years ago
parent 747c7ffdc3
commit c1ef8243a1

@ -631,23 +631,25 @@ define([
if (!data.FM) { return; }
var $input = $('<input>', {
'type': 'file',
'style': 'display: none;'
'style': 'display: none;',
'multiple': 'multiple'
}).on('change', function (e) {
var file = e.target.files[0];
var ev = {
target: data.target
};
if (data.filter && !data.filter(file)) {
return;
}
if (data.transformer) {
data.transformer(file, function (newFile) {
data.FM.handleFile(newFile, ev);
if (callback) { callback(); }
});
return;
}
data.FM.handleFile(file, ev);
var files = Util.slice(e.target.files);
files.forEach(function (file) {
var ev = {
target: data.target
};
if (data.filter && !data.filter(file)) {
return;
}
if (data.transformer) {
data.transformer(file, function (newFile) {
data.FM.handleFile(newFile, ev);
});
return;
}
data.FM.handleFile(file, ev);
});
if (callback) { callback(); }
});
if (data.accept) { $input.attr('accept', data.accept); }

@ -1805,14 +1805,17 @@ define([
.click(function () {
var $input = $('<input>', {
'type': 'file',
'style': 'display: none;'
'style': 'display: none;',
'multiple': 'multiple'
}).on('change', function (e) {
var file = e.target.files[0];
var ev = {
target: $content[0],
path: findDropPath($content[0])
};
APP.FM.handleFile(file, ev);
var files = Util.slice(e.target.files);
files.forEach(function (file) {
var ev = {
target: $content[0],
path: findDropPath($content[0])
};
APP.FM.handleFile(file, ev);
});
});
$input.click();
});

Loading…
Cancel
Save