Hi,All:
how to handle file upload in matation ?
We use a separate endpoint for file uploads. Browsers are expecting to POST a multipart form body with the file. Once the upload was successful you can refetch the file data from the server using a standard query, or subscribe to it first and get notified.
@vektah
thanks!
did you mean graphql level can't directly handle multi-form file upload ?
where define this behavior(can't support multi-form) ?
graphQL spec or gqlgen
There is nothing in the graphql spec that talks about file uploads. You could look at implementing something like https://github.com/jaydenseric/apollo-upload-server but I would just step out of graphql for this and keep it simple.
I'm going to close this out, I don't think it belongs in gqlgen because:
There is a spec for this. Not sure what's the FB takke on this. Apollo implements it:
https://www.apollographql.com/docs/guides/file-uploads.html
I think it would be good to have a default support in GraphQL rather than escaping to REST.
Most helpful comment
There is a spec for this. Not sure what's the FB takke on this. Apollo implements it:
https://www.apollographql.com/docs/guides/file-uploads.html
I think it would be good to have a default support in GraphQL rather than escaping to REST.