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