Say Android seven cow picture upload

Source: Internet
Author: User

Seven bull picture upload business process (This is the official figure):


From the know, to achieve the image upload, it is to three-side interaction (I just started to think that as long as seven cattle server interaction with the client line)

The next steps are as follows:

1, first of all must have a seven cattle account, and create a space

2. The client sends a request to the Business Server (that is, the client's application server) you want to upload more than one picture

3, the Business Server based on the client's request to seven cow cloud storage to generate tokens (the application server download the corresponding seven KN SDK and then according to the interface document to the seven KN server request Token,token equivalent to a key, the specific code I do not know how to achieve, after all, I am not writing backstage, The official interface documentation is available. )

4, the client receives the token returned by the Business Server can be uploaded. (generally no matter how many images you request to upload, the server will return multiple identical tokens, which means tokens can always be used)

Upload part of the code as follows:

UploadManager UploadManager = new UploadManager ();

Uploadmanager.put (Path, key, Qiniutoken, new Upcompletionhandler () {


@Override
public void complete (String key, Responseinfo info,
Jsonobject response) {

if (Info.isok ()) {

Toasthelper.shownewtoast (context, "image upload success");

}

}

Where path refers to the path of your local file, key refers to the file name you uploaded to the seven server (you can also spell the folder path in the file name), Qiniutoken refers to the token returned by the Business Server.

If the upload is successful, use "Info.isok ()" to determine the line.

Note: The Seven Ox SDK only supports single-image upload, if you want to achieve multi-image upload, write your own. (What I've written earlier is that every picture you upload opens a thread and then plugs into the queue.) Then start on the line)

Also, seven of the official SDK imported into the project can not be relied on, I have tried many times can not. Then I find a Daniel to get a copy can be under, the address is as follows: http://download.csdn.net/download/u013560890/8563117

Say Android seven cow picture upload

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.