I have an HTML form with a file upload input. The form data is stored in a FormData() object so I can send it to the server using AJAX.
What I'm trying to do is access the FormData() values so I can modify the file contents that appear in the request. I have been monitoring the requests in Web Developer Tools -> Network.
If I'm uploading a .txt file or image, I want to be able to read its content, modify it and append it to the FormData().
My code so far is able to show the File object but I have no clue how to access the contents.
for( var pair of myFormData.entries() ){
/* pair[1] is the file object inside the FormData */
console.log(pair[0], pair[1]);
}
Thank you.