Android Multipart image upload to Azure -


is there way way upload image android device azure bucket ?

try let me know whether work or not

 public httpresponse request(string filepath, string url) {        httpclient httpclient = new defaulthttpclient();       httpclient.getparams()             .setparameter(coreprotocolpnames.protocol_version, httpversion.http_1_1);        httppost httppost = new httppost(url);       multipartentity mpentity = new multipartentity();              file file = new file(filepath);          contentbody cbfile = new filebody(file, "image/png");          mpentity.addpart(parameter_signature, cbfile);        try {           httppost.setentity(mpentity);          system.out.println("executing request " + httppost.getrequestline());          httpresponse response;          response = httpclient.execute(httppost);          httpclient.getconnectionmanager().shutdown();          return response;       } catch (exception e) {          e.printstacktrace();       }       return null;    } 

asynctask class

public class task extends asynctask<string, void, httpresponse> {        private exception exception;         protected void onpostexecute(httpresponse response) {          log.i("loader ", response.getstatusline().tostring());          // if (resentity != null) {          // system.out.println(entityutils.tostring(resentity));          // }           int status = response.getstatusline().getstatuscode();          if (status == 200) {           log.i("loader ", "upload ok");          } else {           log.i("loader ", "upload failed");          }        }        @override       protected httpresponse doinbackground(string... params) {          try {              return request(params[0], params[1]);          } catch (exception e) {             this.exception = e;             return null;          }       }        public exception getexception() {          return exception;       }    } 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -