Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To retrieve a file from formData in JavaScript, you can use the get() method. For example, if your formData object is named formData and the file input has a name of file, you can get the file using:

const file = formData.get('file');

To send the file again, you can create a new FormData object and append the file to it using the append() method. For example:

const newFormData = new FormData();
newFormData.append('newFile', file);

Then you can use fetch or XMLHttpRequest to send the newFormData object to the server.