简体   繁体   English

使用改造上传图像

[英]Image upload using retrofit

I am uploading image/file using retrofit 我正在使用改型上传图像/文件

here I am posting My API call to upload image 我在这里发布我的API调用以上传图片

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"}}}

Please help me how to write interface for this call, I have tried with @part and @PartMap but does not work 请帮助我如何为该调用编写接口,我已经尝试使用@part和@PartMap,但无法正常工作

I have found solution of above mentioned problem 我已经找到上述问题的解决方案

Create a JSON string which contains query string parameters, and then pass Query string to API interface 创建一个包含查询字符串参数的JSON字符串,然后将查询字符串传递给API接口

@Multipart
@POST("index.php")
Call<ResponseBody> uploadImage(@Query("request") String request, @Part MultipartBody.Part fileBody);

More suggestions are welcomed 欢迎更多建议

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM