Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on How can I upload images or files to strapi using graphQl
Post
How can I upload images or files to strapi using graphQl
How can I upload images or files to strapi using graphQl.
I'm using Cloudinary as the image provider. The strapi admin panel works fine, uploads the images to cloudinary. But, when using graphQl mutation I get an error.
This is the mutation I've tried
''' mutation { createProject(data: { title: "$name", description: "$description", completed: $completed, start_date: "$startDate", end_date: "$endDate", project_logo: upload(file: $projectLogo){ name }, publishedAt: "${publishedAt}Z" }){ data{ id, attributes{ title, description, completed, start_date, end_date } } } }''';
I'm using flutter to pick the image and the graphql plugin to send the mutation. The image projectLogo is of Uint8List?
when I Try-Catch the error, this is what is showing
EXCEPTION=> Error on line 8, column 29: Expected an object field name ╷ 8 │ project_logo: upload(file: [137, 80.....])
1 comment thread