To upload multiple files using JavaScript formData, we call append with an array key.
For instance, we write
fd.append("fileToUpload[]", document.getElementById("fileToUpload").files[0]);
to call fd.append with the "fileToUpload[]" array key and a file we get from a file input.
We get the file input with getElementById.
And we get the selected files from the files property.