i trying upload file amazon cloud drive using android api (link)
i using asynchttpclient. below code have tried, did not ran sucessfully, know correct parameter , header set before making post request.
i have logged in , have token.
asynchttpclient cli = new asynchttpclient(); requestparams params = new requestparams(); params.put("kind","file"); params.put("name","img.jpg"); try{ params.put("file",new file(/sdcard/img)); } catch(exception e){ } // other request param go here chi.addheader("authorization: bearer",authztoken); chi.("content-na.drive.amazonaws.com/cdproxy/nodes", param, new asynchttpresponsehandler() { @override public void onsuccess(int statuscode, header[] headers, byte[] responsebody) { log.e("tagggggggggggggggg", "" + statuscode); // toast.maketext(getapplicationcontext(), "not possible", toast.length_short).show(); } @override public void onfailure(int statuscode, header[] headers, byte[] responsebody, throwable error) { } });
short answer: no.
your post body needs comply multipart/form-data
format specified. there 2 parts: "metadata" , "content". kind , name must put in "metadata" part , actual file content goes in "content" section.
update: please google multipart form data encoder android.
Comments
Post a Comment