Answer the question
In order to leave comments, you need to log in
Uploading a photo to a test site always returns a 201 code?
Tell me if I wrote the file upload correctly? Because no matter what path I specify, even if it's just a random set of characters, the answer is always 201.
val path =Uri.parse(data?.data?.path)
val file = File(path.toString())
val requestFile = file.absolutePath.toRequestBody("multipart/form-data".toMediaTypeOrNull())
val multipartBody = MultipartBody.Part.createFormData("file",file.name,requestFile)
repository.uploadPhoto(multipartBody)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question