Computer scienceProgramming languagesKotlinAdditional instrumentsAdditional librariesCommunications and Networks

Retrofit

Upload a file

Report a typo

We are coding our client with Retrofit, and we have a function to perform a file upload: suspend fun uploadFile(filePart: MultipartBody.Part, description: RequestBody). The result is an UploadDto in the endpoint: api/upload/. Please complete with the annotation to perform the operation.

/* Write your code */
@POST("api/upload")
suspend fun uploadFile(
    @Part filePart: MultipartBody.Part, 
    @Part("description") description: RequestBody
): Response<UploadDto>
Enter a short text

Create a free account to access the full topic