ImagePicker icon indicating copy to clipboard operation
ImagePicker copied to clipboard

open failed: ENOENT (No such file or directory)

Open erizoo opened this issue 2 years ago • 4 comments

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)"

erizoo avatar Oct 21 '22 06:10 erizoo

Can you add your code snippet?

Also, when you use the URI to display the image locally, does it work correctly?

Drjacky avatar Oct 21 '22 09:10 Drjacky

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)

nishkul avatar Oct 30 '22 08:10 nishkul

Please try I this new version: 2.3.21 and let me know if it fixed the issue or not

Drjacky avatar Dec 19 '22 11:12 Drjacky

@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.

Jimit-speed avatar Apr 04 '24 11:04 Jimit-speed