widget/reply: load file upload progress indicator
[minimedit.git] / progress.js
index b93d61fe13236f9e59ca224bfd28998b2bc073ac..e59422de841e879c2c176475e2896796c6d3c7c8 100644 (file)
@@ -46,12 +46,7 @@ function trackupload(input) {
 
        ajax.open('POST', input.form.action);
        ajax.setRequestHeader('Accept', 'text/plain')
-
-       var form = new FormData();
-       for (let file of input.files) {
-               form.append('image[]', file);
-       }
-       ajax.send(form);
+       ajax.send(new FormData(input.form));
 
        var cancel = document.createElement('BUTTON');
        cancel.textContent = 'Afbreken';
@@ -62,7 +57,7 @@ function trackupload(input) {
 
 document.addEventListener('DOMContentLoaded', e => {
        for (let row of document.forms[0].elements) {
-               if (row.name == 'image[]') {
+               if (row.type == 'file') {
                        row.form.onsubmit = () => {
                                trackupload(row);
                                return false;