fixed js error if no image is attached

This commit is contained in:
Jan Felix Wiebe 2019-02-23 13:40:29 +01:00 committed by /jedi/
parent a8e44cb55a
commit f2aaadac79

View file

@ -129,8 +129,10 @@
} }
var form = new FormData(document.querySelector("#lost_form")); var form = new FormData(document.querySelector("#lost_form"));
if (fileInput.files.length > 0) {
form.append('title', fileInput.files[0].name); form.append('title', fileInput.files[0].name);
form.append('image', fileInput.files[0]); form.append('image', fileInput.files[0]);
}
xhr.send(form); xhr.send(form);