android - MultipartEntity post array -


i'm trying upload file using http post request. figured doable using multipartentity, such:

multipartentity entity = new multipartentity(); ... entity.addpart("caption", new stringbody("mycaption")); entity.addpart("file", new filebody(file)); entity.addpart("uploadername", new stringbody("myname")); ... 

my problem structure post request needs made. instead of rather straightforward...

{     "caption":[caption],     "file":[file upload],     "uploadername":[name] } 

..it is..

{     "newfile":     {         "caption":[caption],         "file":[file upload]     },     "uploadername":[name] } 

if don't need post files, can use jsonobject , put 1 jsonobject inside other, can't figure out way multipartentity. clues? in advance.

..okay, guess found way it.

.... entity.addpart("newfile[caption]", new stringbody("mycaption")); entity.addpart("newfile[file]", new filebody(file)); entity.addpart("uploadername", new stringbody("myname")); ... 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -