Gqlgen: Feature - File Upload

Created on 24 Apr 2018  路  5Comments  路  Source: 99designs/gqlgen

Hi,All:

how to handle file upload in matation ?

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.

All 5 comments

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:

  • its not in the spec
  • its not a super common use case (like Time)
  • it can be implemented as a separate package (and if it cant, lets talk about those issues).

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

msmedes picture msmedes  路  4Comments

steebchen picture steebchen  路  3Comments

RobertoOrtis picture RobertoOrtis  路  3Comments

kevinmbeaulieu picture kevinmbeaulieu  路  3Comments

theoks picture theoks  路  3Comments