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
URLin the URL bar and follow the below steps.
Directions#
- Construct the
mutationwith 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
Filesarea in the playground area. Upload the file of your choice with theChoose filesoption. 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
Ctrlkey while selecting files.In the
Explorertab, assign the variablefiles*with$andVariable-namethat we've used while Uploading files.Hit the play button.
You'll receive the response.