How do i upload a file to ariadne? #883
Replies: 2 comments
-
I have the same question. Someone has an example? or solution?
And then start server
|
Beta Was this translation helpful? Give feedback.
-
Remember that you also need to configure file uploads in the client, so files are actually sent to your GraphQL server by the client. For example, for Apollo Client you have to use the apollo-upload-client Privately speaking I prefer having separate non-GraphQL endpoint for uploads, because that way I can have upload progress bar and I don't have long-running GraphQL requests in the app, but I've got quick proof of concept for user avatar uploads in my personal project and it worked on first try: Apollo Client setup using the apollo-upload-client: https://github.com/rafalp/misago-client/blob/1585a0b81b1e8d99b24e7d6437df3009fc51b642/src/apolloClient.ts#L24 Avatar upload Mutation: https://github.com/rafalp/misago-client/blob/3daeb7d58cee4e0681e77a778def23adc16adc87/src/AvatarModal/useAvatarUploadMutation.ts Avatar upload form using the above mutation: https://github.com/rafalp/misago-client/blob/4d094cafaf45d671d8c8fad6cab6ab22d7e574ad/src/AvatarModal/AvatarUploadForm.tsx |
Beta Was this translation helpful? Give feedback.
-
Ive tried the scalar guide but nothing reaches the endpoint
Beta Was this translation helpful? Give feedback.
All reactions