Form
<form id="my_form">
<input type="file" name="my_file">
<input type="text" name="field_one">
<input type="text" name="field_two">
<button>send</button>
</form>
Create FormData Object
var myFormData = new FormData($("#my_form")[0]);
Question
Is the filename of my_file
accessible even though it hasn't been specifically defined (for DOM manipulation and inserting into database)?
This states:
You can also append a File or Blob directly to the FormData object, like this:
data.append("myfile", myBlob, "filename.txt");
But it doesn't specify whether a filename is automatically added when creating the FormData
object from an existing form.
If it is not automatically appended, is the only option to manually create a FormData object through multiple append()
statements in which case filename definition is possible?