Launch Firecamp

06. Uploading File within GraphQL request


Prerequisites

  1. To elaborate this actions we're using the example of GraphQL file Upload
  2. You can clone and use this example too.
  3. Write server URL in the URL bar and follow the below steps.

Directions

  1. 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
  }
}
  1. After writing your mutation, navigate to the Files area in the playground area. Upload the file of your choice with the Choose 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.

  2. In the Explorer tab, assign the variable files* with $ and Variable-name that we've used while Uploading files.

  3. Hit the play button.

  4. You'll receive the response.

file upload in graphql

Additional resources

Edit on GitHub