retrofit - How to set dynamic filename? -


using retrofit 2, how set dynamic name uploaded file?

currently, it's this:

@part("avatar\"; filename=\"image\" ") requestbody image, 

however, uploaded file name image without extension. recommendation on case?

define endpoint multipartbody.part type:

interface example {   @multipart //   @post("/foo/bar/") //   call<responsebody> method(@part multipartbody.part part); } 

and use factories create type:

requestbody body = // image body... call<responsebody> call = example.method(     multipartbody.part.createformdata("image", "whatever.png", body)); 

Comments