ImagePicker
ImagePicker copied to clipboard
open failed: ENOENT (No such file or directory)
Hi, I try save result uri to file, that upload to server, but i get this error to upload "open failed: ENOENT (No such file or directory)"
Can you add your code snippet?
Also, when you use the URI to display the image locally, does it work correctly?
even for me issue is the same
var file = File(userProfileUrl.toString())
val reqFile = file.asRequestBody("application/image".toMediaTypeOrNull())
val imageBody = MultipartBody.Part.createFormData("image", file.name,reqFile)
Please try I this new version: 2.3.21 and let me know if it fixed the issue or not
@Drjacky I am facing the same issue and using the latest version of this SDK.
Here is my snippet which I integrated.
ImagePicker.with(this)
.galleryOnly()
.galleryMimeTypes(
arrayOf(
Constants.MIMETypes.IMAGE_PNG,
Constants.MIMETypes.IMAGE_JPEG,
Constants.MIMETypes.IMAGE_JPG,
),
)
.createIntent()
.also {
selectImageCropResultLauncher?.launch(it)
}
Uri: content://media/picker_get_content/0/com.android.providers.media.photopicker/media/1000154898
File path Data -> /sdcard/.transforms/synthetic/picker_get_content/0/com.android.providers.media.photopicker/media/1000154898.jpg
use this method to upload a file to the server.
val multipartBody = MultipartBody.Part.createFormData(
name = "file",
filename = imageFile.getName(),
body = imageFile.asRequestBody(contentType = "image/*".toMediaType()),
)
Please help to fix this issue.