I am uploading a media file from my mobile gallery then I get a URI and get a real path and then save it in a list and on submit button click I get all the paths of the item and upload them one by one. but not uploading.
private fun getMultiPartFromPath(path: String, partName: String): MultipartBody.Part {
val file = File(path)
// create RequestBody instance from file
// create RequestBody instance from file
val requestFile: RequestBody = file.asRequestBody("*/*".toMediaTypeOrNull());
// MultipartBody.Part is used to send also the actual file name
// MultipartBody.Part is used to send also the actual file name
return MultipartBody.Part.createFormData(partName, file.name, requestFile)
}
and here I am uploading this file
val response = createNoteRepository.uploadFile(body, length)
this exception thrown
android.system.ErrnoException: open failed: EACCES (Permission denied)