Unable to read file

:point_down: :point_down:

1 Like

Try with the file name only.Ex. /File.txt

1 Like

Same…hmm :frowning_face:

1 Like

Documentation:

Reads text from a file in storage. Prefix the fileName with / to read from a specific file on the SD card (for example, /myFile.txt will read the file /sdcard/myFile.txt ). To read assets packaged with an application (also works for the Companion) start the fileName with // (two slashes). If a fileName does not start with a slash, it will be read from the application’s private storage (for packaged apps) and from /sdcard/AppInventor/data for the Companion.

I think you need to test as apk.And try:
/File2String/File.txt

I have already saw in kodular docs :sweat_smile:

Dont think so

Please try.And try also /File2String/File.txt

1 Like

Tried…Not work

1 Like

Did you tried /File2String/File.txt
Also does you file exist.Take card that it case senstive.Means that File and file aren’t the same.
Also try with the complete path:
/mnt/sdcard/File2String/File.txt

Can you try and say instead of just guessing? :sweat_smile: @Mohamed_Tamer

That really work with me.I’m not guessing!

1 Like

Really??? :sweat_smile:

1 Like

Yes.Can you show me your blocks?Also did you asked for READ_EXTERNAL_STORAGE

The storage permission is already granted, can you give me any test AIA?

Ok.I will give you one.

1 Like

Did you build or just test in the Companion? Either way, if I’m correct, Kodulars file component prepends /storage/emulated/0 to your file. Can you test just /File2String/File.txt after creating the file for me?

@Mohamed_Tamer may have been correct by this post if you haven’t tried it yourself @Business_World.

2 Likes

I already told him that :grin: or i understood you wrong?

Try this:
FileTest.aia (13.2 KB)

1 Like

Which is why I gave you credit for the original solution… because I don’t like when people mark others responses as a solution when I originally gave it to them, so I feel that others take it the same way as I do.

1 Like

Try this:

grafik

1 Like

The File component uses different paths (relative / absolute) for methods (blocks). In this case (.ReadFrom) the relative path is needed.

See also here:

1 Like