Upload files through the router using GraphQL multipart request.
multipart/form-data
content type. Cosmo supports both single and multiple file uploads, but batch uploads are not supported.
The router can be configured for file uploads with these options.
null
. This object defines the GraphQL query or mutation to be executed, along with the necessary variables.
Upload
in your schema. This scalar will be used for the field type where you intend to upload files.
curl
command:
operations
defines the GraphQL mutation with the file
variable set to null
.
map
associates the form field 0
with variables.file
.
0=@a.txt
uploads the file a.txt
with the form field name 0
.
curl
command:
operations
defines the GraphQL mutation with the files
variable set to an array of null
values.
map
associates the form fields 0
and 1
with variables.files.0
and variables.files.1
respectively.
0=@a.txt
and 1=@b.txt
upload the files a.txt
and b.txt
with form field names 0
and 1
.