create a new input file for each upload

This commit is contained in:
lxsang 2021-04-09 22:13:42 +02:00
parent 25f95360d6
commit b69103107c
3 changed files with 8 additions and 6 deletions

Binary file not shown.

View File

@ -1208,7 +1208,10 @@ namespace OS {
return new Promise(function (resolve, reject) {
const q = announcer.getMID();
//insert a temporal file selector
const o = $("#antos_upload_files");
const o =
$("<input>")
.attr("type","file")
.attr("multiple","true");
o.on("change", function () {
const files = (o[0] as HTMLInputElement).files;
const n_files = files.length;
@ -1232,18 +1235,20 @@ namespace OS {
{
API.loaded(q, p, "OK");
resolve(data);
o.remove();
}
})
.fail(function (j, s, e) {
tasks.push("FAIL");
if (tasks.length == n_files)
{
API.loaded(q, p, "FAIL");
o.remove();
}
reject(API.throwe(s));
});
});
});
($("#antos_upload_form")[0] as HTMLFormElement).reset();
(o[0] as HTMLInputElement).value = "";
return o.trigger("click");
});
}

View File

@ -1222,9 +1222,6 @@ namespace OS {
<afx-menu id="contextmenu" data-id="contextmenu" context="true" style="display:none;"></afx-menu>
<afx-label id="systooltip" data-id="systooltip" style="display:none;position:absolute;"></afx-label>
<textarea id="clipboard"></textarea>\
<form id="antos_upload_form" style="display: none;">\
<input type="file" id="antos_upload_files" name="files" multiple>\
</form>\
`;
schemes.login = `\