Skip to content

Commit

Permalink
🏭 Support FileList objects in the form data addon
Browse files Browse the repository at this point in the history
Solves #201
  • Loading branch information
elbywan committed Sep 12, 2023
1 parent 411fb09 commit 3582809
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/addons/formData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ function convertFormData(
acc ? `${acc}[${ancestor}]` : ancestor
), null)
formKey = formKey ? `${formKey}[${key}]` : key
if (value instanceof Array) {
for (const item of value)
if (value instanceof Array || (globalThis.FileList && value instanceof FileList)) {
for (const item of value as File[])
formData.append(formKey, item)
} else if (
recursive &&
Expand Down

0 comments on commit 3582809

Please sign in to comment.