How Save a Image to own Storage with TinyDB

Hello,

i Want to Store here my Images into my own Folder, is it Possible to do this with the TinyDB? i get it to work but with this code, it save it to the Data Storage and my Phone dont let me go into this Folder .

Or did i have to use the Canvas ?

You can save a filepath to tinydb, but not a binary file.

Save files to either the private directory (only accessible by the app itself) or the ASD (accessible by some File managers) ?

You could convert your files to base64 string and save them that way to tinydb.

Hey Tima, I want to Save my Png in as example to Gallery, i am new in this and dont know right how , is it possible u help me there out?

There is no such folder as "the Gallery" it is a virtual location for displaying media files from the shared folders on the device.

See here for how to save a file to a shared folder:

You may then need an extension to refresh the Gallery

sorry i dont get it, what i have to do, to get it saved as another name and another Storage so i can see the Image in my Gallery and not in the Hiden Data Folder.

  1. Copy the image from ASD to shared storage like /Download using the file component and
  2. use the GalleryRefresh method from the tools extension

See also Some basics on Android storage system

Taifun

1 Like

did i have to use Canvas for it?

Why would you need to use a Canvas ?

No
You might want to read again my previous answer
Taifun

1 Like

I am on the right way? how i get the name, how i can say the Exist file XY have to get Stored to THis Folder, i want it to Pictures

It is not much what is to do, can u pls finish me the last part of the Code to get the save to work? pls

Can someone help me here?

i dont find any Videos about that :'D

With what?

Describe exactly what the goal is. On Android 11+ you can only store files in the ASD or one of the Shared folders.

Anke i try to get the Images saved in the Shared Folders so it apears in the Gallery, from ASD its not showing in my Gallery and i dont have access to it, i have Android +11, at the Code itself i dont get a progress, it is mabe not much left to get this to work, and i hope someone can help me there with the Code, i am not good in Coding, i tryed some times and it worked but here i dont get my way i want .

@Taifun already explained it:

So now i have this in my Code, now it creates soe Folders and saves a Photo with nothing in it but it gives no img there, it Saves still in the Datas

it seems that you did not follow the suggestion from @Taifun. Do as suggested.

i dont get it, i dont know how to do that, i dont get it in my head atm :'D i dont know what i set in there and how, i was happy i got it to work but saving it dont want right

The file component can save text to a text file
You are trying to save an empty string to a png file, which does not really make sense

Use the Copy method of the file component

Taifun

I tryed it but i dont get it right ....

Please help me out there :frowning:

Use Do it and Show us the Do it results

It looks like your replace method does not make sense like that... we will know more after seeing the Do it results

You are using the CopyAsync method of the file extension... you should should use this together with the Copied event as mentioned in the documentation App Inventor Extensions: File | Pura Vida Apps

Event indicating that copying a file has finished, which was started using the CopyAsync method.
In case everything went fine, parameter successful is true. In case an error occurred, parameter successful is false and parameter response will provide an error message.

You forgot to use the GalleryRefresh method... try to use it in the Copied event

Taifun