2

I'm setting up a new payara server i want to upload a file from a my application to the server I have created a java rest web service and i have send Some objects have been successfully received using retrofit 2 Now I want to send a file from my phone to the server I don't know how to write a post method in the java web service to receive a file

this is the interface definition for file uploads using retrofit 2

public interface FileUploadService {  
    @Multipart
    @POST("upload")
    Call<ResponseBody> upload(
        @Part("description") RequestBody description,
        @Part MultipartBody.Part file
    );
}

0 Answers0