How to upload multiple files at the front end and cycle the files so that each file is loaded with id

currently, multiple file uploads are required. If three files are uploaded, then upload asynchronously, one file at a time plus a unique ID.
but at present, according to the saying on the Internet, it is written like this

.
<form id= "uploadForm" action= "" method= "post" enctype ="multipart/form-data">
<input type ="file" name="file[]" id="file" multiple="multiple"/><a href="javascript:;" id="add">[+]</a>

    <input type ="button" value="" id="but"/>

</form>

 //
 $("-sharpbut").click(function(){
  var formData = new FormData($( "-sharpuploadForm" )[0]);
 })

the printed formData is an empty object that cannot be traversed. Please give us some advice on what to do

.
Mar.18,2021

it is not visible to print directly, so use FormData's get () and getAll () methods

formData.append("a", "aa");
formData.append("b", "bb");
formData.append("c", "cc");
formData.get("c"); // console.log

how do you traverse it? you can use the forEach method or for of values

.
Menu