fixed js error if no image is attached
This commit is contained in:
parent
a8e44cb55a
commit
f2aaadac79
1 changed files with 4 additions and 2 deletions
|
@ -129,8 +129,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var form = new FormData(document.querySelector("#lost_form"));
|
var form = new FormData(document.querySelector("#lost_form"));
|
||||||
form.append('title', fileInput.files[0].name);
|
if (fileInput.files.length > 0) {
|
||||||
form.append('image', fileInput.files[0]);
|
form.append('title', fileInput.files[0].name);
|
||||||
|
form.append('image', fileInput.files[0]);
|
||||||
|
}
|
||||||
|
|
||||||
xhr.send(form);
|
xhr.send(form);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue