Image uploading solution for Android retro 2.0 framework
This article shares the image upload solution of Android retro 2.0 framework. The specific contents are as follows
1. Upload of single picture
2. Upload multiple pictures
Note: at present, three copies are provided for uploading. To upload more copies, I found that the method is to add an additional parameter @ part ("file \"; filename = \ "image. Png \" ") requestbody IMGs, and so on.
When you see the above, you feel that the writing method is very leaky, but the ability to use it is limited, so you can only think of this. After using the variable parameters in Java, you can only pass one. No more than one.
Call: call < string > call = apimanager.uploadimage (m [0], requestbody1, requestbody2, null);
It looks very high-end. Unfortunately, it can only be passed on one
3. Finally, implement Hu process 3.1 to create fileuploadservice interface
3.2 creating a retrofit object
3.3 calling upload method
4. Server segment code: the server uses struts to receive:
For more information about Android upload function, please click the topic: Android upload operation summary to learn.
The above is the whole content of this article. I hope it will be helpful to your study.