I tried to find the best practice for uploading fi...
# android
a
I tried to find the best practice for uploading files from an android device to my server. Due to the fact that I fetch all my user data with Apollo GraphQL Client, I tried to use that library for the file upload as well. The mutation for saving all kinds of infos about the file on my database works fine but I cannot really figure out how to upload files/images to my server? I saw that this is possible with Apollo Client but I cannot really find a good explanation on that which explains both sides, server and client side implementation. Is it a good thing to combine Apollo GraphQL and OkHttp3 + PHP script? I would use OkHttp3 + PHP Script to save the file on my server and then Apollo GraphQL Android client to send a mutation with all kinds of info (imageURL, name, content, author, date, isPublished, category, tags) to my Node.js Apollo GraphQL API which saves that on my MySQL Database. Or maybe replace OkHttp3 with Retrofit? Is that a good approach?
😶 5
u
Retrofit is using okhttp client with an extra layer of annotations based functionality to give user more control The problem may come when you need to have a functionality to upload files from Android to your sever with resume/pause feature Otherwise everything is fine