Skip to content

When I lost many time on non working multi file upload, I was surprised why it's not supported. Moreover, fix is trivial, something like #965

Open
@ikzsl

Description

@ikzsl

When I lost many time on non working multi file upload, I was surprised why it's not supported. Moreover, fix is trivial, something like

[ContentType.FormData]: (input: any) =>
  Object.keys(input || {}).reduce((formData, key) => {
    const property = input[key];
    if (Array.isArray(property) && property.every(p => p instanceof Blob)) {
      property.forEach(p => formData.append(key, p));
    } else {
      formData.append(
        key,
        property instanceof Blob
          ? property
          : typeof property === 'object' && property !== null
            ? JSON.stringify(property)
            : `${property}`,
      );
    }
    return formData;
  }, new FormData()),

Originally posted by @darky in #815 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions