File To String Error

Hi All,

I’m trying to convert the image file to string with KIO4_Base64 extension but unable to do that.
I’m using blow blocks but its giving output File not found.

image

Please help me with this as I’m unable to find the error in this.
Thanks

Even if you split at / you doesn’t mention specifically which part have to use

Use split - (select item from list(get selection) index (2))
at (/)

here is my image path
/storage/emulated/0/DCIM/Camera/20210327_104146.jpg

Please tell me what to select so that I can get string for this image

Are you getting any error?

Yes, File not found.

What is your Android version?

I’m using android 10

Seems issue of scoped storage.

can we solve it? its also not working with android 8

You can try:

  1. You need to get the very latest version of the extension that handles all android versions
    Create Build Crear App Inventor Extensions Añadir librería externa Add lib Extension. @UsesLibraries. Pasar imagen a String y viceversa. Base 64.
  2. You need to remove the ASD file path from the image file path
2 Likes

I don’t think it will work as my file path is /storage/emulated/0/DCIM/Camera/20210327_104146.jpg and AsdPath is /storage/emulated/0/Android/data/io.makeroid.companion/files then no replcement will happen.

on your provided link developer has updated the aix download link in april 2021

I am working on AppInventor, but the same should apply. When you use the image picker (I picked an image from the Camera directory offered), a copy of the image file is made:

“Translate” what you see above into your blocks.

Yes, at the time of writing (May 2021), that is the latest version of the extension

Whatever, you should see that you will need to use “Do It” to understand what file paths are being returned, and what changes you need to make to them.

I’m really sorry to say but its not showing the same result in Kodular
/storage/emulated/0/DCIM/Camera/20210327_104146.jpg
but yes are are completely right in AppInventor the result is different
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/Pictures/_app_inventor_image_picker/picked_image3885813697645418603.jpg

I don’t know the reason for it but I guess AppInventor runs on latest update so that might be a reason of it.

try a relative path, which in your case is
/DCIM/Camera/20210327_104146.jpg
probably you can find which path to use in the documentation of the extension…

Taifun

You may need to use the non-ASD FileToString block…because the ASD file path is built in. The non-ASD block has /storage/emulated/0 built in.

Already did but hard luck :slightly_frowning_face:

recommend to use filey

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.