使用改造上传图片 [英] Image upload using retrofit
本文介绍了使用改造上传图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用改造上传图片/文件
I am uploading image/file using retrofit
在这里我发布了我的 API 调用以上传图片
here I am posting My API call to upload image
baseurl/index.php?request={"img_req":{"key":"gflkgjdfkgjdkl","c":"property","a":"pr_image_upload","job_id":"cc65643bfa7f27ca1530281112278_images","parameters":{"property_id":abcded,"auth_key":"kgdfklgjdklfgjk"}}}
请帮助我如何为这个调用编写接口,我已经尝试过@part 和@PartMap 但不起作用
Please help me how to write interface for this call, I have tried with @part and @PartMap but does not work
推荐答案
我已经找到上述问题的解决方案
I have found solution of above mentioned problem
创建一个包含查询字符串参数的JSON字符串,然后将查询字符串传递给API接口
Create a JSON string which contains query string parameters, and then pass Query string to API interface
@Multipart
@POST("index.php")
Call<ResponseBody> uploadImage(@Query("request") String request, @Part MultipartBody.Part fileBody);
欢迎提出更多建议
这篇关于使用改造上传图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文