File uploads

Enabling file uploads in Apollo Client


Apollo Client doesn't support a file upload feature out of the box. If you'd like to enable file upload capabilities, you will have to set Apollo Client up manually with a 3rd party package.

Detailed instructions on how to setup Apollo Client for file upload can be found here: https://github.com/jaydenseric/apollo-upload-client.

An example configuration is show below using the apollo-upload-client package.

Bash
1npm install apollo-upload-client

Basic setup for the Apollo Client:

JavaScript
1import { ApolloClient, InMemoryCache } from "@apollo/client";
2import UploadHttpLink from "apollo-upload-client/UploadHttpLink.mjs";
3
4const client = new ApolloClient({
5  cache: new InMemoryCache(),
6  link: new UploadHttpLink(),
7});
Feedback

Edit on GitHub

Ask Community