06. Uploading File within GraphQL request
Prerequisites
- To elaborate this actions we're using the example of GraphQL file Upload
- You can clone and use this example too.
- Write server
URL
in the URL bar and follow the below steps.
Directions
- Construct the
mutation
with the details you want to insert. For our example we'll write this mutation.
mutation multipleUPload($files: [Upload!]!) {
multipleUpload(files: $files) {
id
filename
mimetype
path
}
}
After writing your mutation, navigate to the
Files
area in the playground area. Upload the file of your choice with theChoose files
option. Along with that, assign the 'Name' of the file variable that we'll pass in the mutation function argument.Incase of multiple uploads, hold the
Ctrl
key while selecting files.In the
Explorer
tab, assign the variablefiles*
with$
andVariable-name
that we've used while Uploading files.Hit the play button.
You'll receive the response.
