java - how to upload multimedia files into azure from android application -


is there way can upload multimedia files such audio voice recorder or photo camera function android application microsoft azure?

i looked @ tutorial given such server , client side , inserted code project. how upload them through "send" button on application?

please advice. below codes basic camera application

package com.example.testproject;  import android.app.activity; import android.content.intent; import android.graphics.bitmap; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.imageview;  public class camera extends activity{  imageview iv;  public void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); setcontentview(r.layout.camera);   iv = (imageview) findviewbyid(r.id.imageview1); button btn = (button) findviewbyid(r.id.btnphoto); btn.setonclicklistener(new onclicklistener(){      public void onclick(view v){         intent intent = new intent(android.provider.mediastore.action_image_capture);         startactivityforresult(intent, 0);     } });  }  protected void onactivityresult(int requestcode, int resultcode, intent data) { if(requestcode == 0) {     bitmap theimage = (bitmap) data.getextras().get("data");     iv.setimagebitmap(theimage); } }   } 

if have windows azure storage account, create blob container , upload media files blobs stored container. application control access clients have these files using shared access strings or stored access policy. example, following code runs java console application , uploads local .jpg file, along explanatory metadata, blob in cloud.

public class sasmeta  { public static void main(string[] args) throws urisyntaxexception, filenotfoundexception, storageexception, ioexception     {                            uri baseuri = new uri("http://grassy.blob.core.windows.net");    cloudblobclient blobclient = new cloudblobclient(baseuri);    myuploadblob("container1","sr=c&sv=2012-02-12&sig=b%2bk%2fmx8r7dlcvxs5pspmmji1l6ksxnupp9skf7yj27w%3d&si=r",blobclient);              }  public static void myuploadblob(string containername, string containersas, cloudblobclient blobclient) throws urisyntaxexception, storageexception, filenotfoundexception, ioexception    {        string blobname = "image1.jpg";      string localfilename = "c:\\myimages\\image1.jpg";      uri uri = new uri(blobclient.getendpoint().tostring() + "/" + containername + "/" + blobname + "?" + containersas);    cloudblockblob sasblob = new cloudblockblob(uri, blobclient);        hashmap<string, string> user = new hashmap<string, string>();        user.put("firstname", "joe");    user.put("lastname", "smith" );    user.put("age", "28");    user.put("presenter", "no");      sasblob.setmetadata(user);    file filereference = new file(localfilename);    sasblob.upload(new fileinputstream(filereference), filereference.length());    system.out.println("the blob: " + blobname + " has been uploaded to:");    system.out.println(uri);    } }   

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -