Back to Apollo Client

File uploads

docs/source/data/file-uploads.mdx

3.14.1845 B
Original Source

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
npm install apollo-upload-client

Basic setup for the Apollo Client:

js
import { ApolloClient, InMemoryCache } from "@apollo/client";
import UploadHttpLink from "apollo-upload-client/UploadHttpLink.mjs";

const client = new ApolloClient({
  cache: new InMemoryCache(),
  link: new UploadHttpLink(),
});