i am trying to upload a form data in js into my flask server but i am not getting file in the server.
My code in JS is:
 const form = document.forms.namedItem('fileinfo')
        form.addEventListener('submit', async (event) => {
            event.preventDefault()
            let formData = new FormData(form)
            formData.append('firstName', 'John')
            let file1 = document.getElementById('fileInput').files[0]
            console.log(formData)
            let response = await fetch('http://127.0.0.1:5000/stateUpload', {
                method: 'POST',
                body: formData,
            })
            let _response = await response.json()
        })
and this is my flask code:
@app.route("/stateUpload", methods=[ "POST"])
def stateUpload():
    _data = request.form.to_dict(flat=False)
     print("this is form data")
     print(_data)
     return "JSON File successfully uploaded"
This is my output in console in server when i press submit button:
this is form data
{'firstName': ['John']}
and this is my output in front end:
i am not able to get this file in the flask

 
     
    