Skip to content

Commit 915873e

Browse files
Update src/pages/learn/file-uploads.mdx
Co-authored-by: Benjie <[email protected]>
1 parent 4ff70a9 commit 915873e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/pages/learn/file-uploads.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ This guide explains why file uploads via GraphQL are problematic and presents sa
88
## Why uploads are challenging
99

1010
The [GraphQL specification](https://spec.graphql.org/draft/) is transport-agnostic and serialization-agnostic (though HTTP and JSON are the most prevalent combination seen in the community).
11-
File uploads, by contrast, require `multipart/form-data` encoding to transfer binary data—something JSON can’t handle.
11+
GraphQL was designed to work with relatively small requests from clients, and was not designed with handling binary data in mind.
12+
13+
File uploads, by contrast, typically handle binary data such as images and PDFs &mdash; something many encodings, including JSON, cannot handle directly.
14+
One option is to encode within our encoding (e.g. use a base64-encoded string within our JSON), but this is inefficient and is not suitable for larger binary files as it does not support streamed processing easily.
15+
Instead, `multipart/form-data` is a common choice for transferring binary data; but it is not without its own set of complexities.
1216

1317
Supporting uploads over GraphQL usually involves adopting community conventions, like the
1418
[GraphQL multipart request specification](https://github.com/jaydenseric/graphql-multipart-request-spec). While useful in some

0 commit comments

Comments
 (0)