Im sending a form with multiple files using formData, and i would like to add a 'flag' to one of this files.
Im trying something like this without success:
for (let file of fu.files) {
if (file.name == 'x') file.flag = true;
else file.flag = false;
formData.append(name, file, file.name);
}
And the file in the request starts with:
-----------------------------22161056743320652140255036212
Content-Disposition: form-data; name="file_0"; filename="name.jpeg"
Content-Type: image/jpeg
... image ...
Exactly what i want is to add a custom key val like 'name' or 'filename', an receive it easily on the server side.
I can resolve it by other means, like adding another field to formData, but im wondering if is it possible in the way im asking.