Android4. 4. Web API realizes photo upload function
There are many ways to upload photos online. If you use the new version of Android to run, you may find that it can't be realized at all. The main reason is that Android has passed intent. Com since version 4.4 ACTION_ GET_ After content opens the selector, the URI returned by GetData () does not contain the real file path, but looks like this“ content://com.android.providers.media.documents/document/image:1234 ”So that the path of the picture cannot be found in the traditional way. The simplest solution is to use intent ACTION_ Pick instead of intent ACTION_ GET_ CONTENT。
The specific implementation method of photographing and uploading after version 4.4 is given below:
Step 1: click the Photo button code
Step 2: save the photo code
Step 3: upload picture code
Finally, the web api code of the server is given:
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.