Is it possible to send a POST
request with a form-data
body using Postman, along with the following key-value
pairs?
https://i.sstatic.net/VC2LYMkt.png
When attempting to include multiple files, designated as File[]
, within a single Blob
(as shown in the sample below):
const convertFilesToFormData = (files: File[]): FormData => {
let formData = new FormData();
formData.append("files", files);
return formData;
} // NOTE: This is a simplified version of my original function.
An error was encountered, stating:
No overload matches this call.
Overload 1 of 3, '(name: string, value: string | Blob): void', gave the following error.
Argument of type 'File[]' is not assignable to parameter of type 'string | Blob'.
Type 'File[]' is missing the following properties from type 'Blob': size, type, arrayBuffer, stream, text
Overload 2 of 3, '(name: string, value: string): void', gave the following error.
Argument of type 'File[]' is not assignable to parameter of type 'string'.
Overload 3 of 3, '(name: string, blobValue: Blob, filename?: string | undefined): void', gave the following error.
Argument of type 'File[]' is not assignable to parameter of type 'Blob'.ts(2769)
I am seeking information on whether it is feasible and the techniques required for converting to the Blob
type for future fetch
requests.