Closed Heni-ghodbane closed 1 year ago
The solution was to enable the multipart request on the client-side in the index.js file by adding link: createUploadLink()
instead of link: new HttpLink
I am using graphql-upload to upload file on server-side
See below:
import { createUploadLink } from 'apollo-upload-client';
const option = {
uri: "http://localhost:4000/graphql",
credentials: "include"
}
const client = new ApolloClient({
cache: new InMemoryCache(),
link: createUploadLink(option),
/*link: new HttpLink({
uri: "http://localhost:4000/graphql",
credentials: "include"
}),*/
});
For more details, see the installation section of apollo-upload-client
This is the whole issue description on stackoverflow
I have tested the mutation through Postman, and it works correct.
But I don't know how to convert this Postman file upload request to TS react code.
Could some hone help me. I hope the issue and solution, will help others who are running on the same issue/need.
Many thanks,