Can you help me with uplod cat images? CatApi

I try to use upload image api on my mobile app. I have got api for this call like that

 @POST("images/upload")
@Multipart
suspend fun uploadImage(
    @Header("x-api-key") apiKey: String,
    @Part("description") desc:String,
    @Part body: MultipartBody.Part
): UploadCatResponse

Then I call this method in my class

class SendPhotoModel {

private val session = App.SessionStorage.getSession()

fun uploadPhoto(
    file: File,
    listener: (Int) -> Unit
) = flow {
    session?.let {
        val fileRequestBody =
            MultipartBody.Part
                .create(
                    file.asRequestBody("image/*".toMediaType())
                )

        emit(
            Api.getApi().uploadImage(
                App.ApiKeyProvider.getKey(),
                it.userId,
                fileRequestBody
            )
        )
    }
}

}

And I get response " {“message”:“Cannot read property ‘name’ of undefined”,“status”:500,“level”:“info”}"
What’s the name? What should I do to skip this error?

Good question. The Image Upload currently only supports a FormData style upload - so for Kotlin this example would work - the “createUploadRequest” function from https://www.lordcodes.com/articles/uploading-a-file-with-progress-in-kotlin

I’ll add support for the way you tried, and base64 upload in a future version of the API