How to delete a file in the internal storage

yes, these permissions never existed and WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE do not exist anymore for devices Android 11+

Taifun

A small correction: WRITE_EXTERNAL_STORAGE does no longer exist on Android 11+ and READ_EXTERNAL_STORAGE does no longer exist on Android 13+.

[quote=“ForRob, post:1, topic:247026”]
And this is the blocks to delete the file :
blocks(1)

The File component uses a relative path.

You cannot delete a file in the root dir of the external storage on Android 11+ (without all-file-permission, which is not allowed by Google in the Play Store).

Ok so how to store the edited pictures on a specific folder and then delete it ?

Now we are again at rhe beginning of this thread

Taifun

Ok but why is there an error The permission WRITE_EXTERNAL_STORAGE is denied on some devices when I just want to pick an image with the"Image_Picker" component.

Some this explanation

In the same thread you can find a workaround

Taifun

So as I’ve read in this topic :

I’ve tried to store the picture in the ASD using this path :

 /storage/emulated/0/Android/data/<packageName>/files/

But it still doesn’t work and the Image Editor is not returning any image

Very good
Now if you use the ApplicationSpecificDirectory method from the tools extension, you get that path dynamically, which will work for the companion app and after building any app

Taifun

Do I have to do this ? I don’t understand

It stillk doesn’t work

Now use Do it to check the filename…

Most probably a slash is missing…

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps

see also Live Development, Testing and Debugging

Taifun

So this is what I get :

I added a slash and this is what I get :

On the companion when I try to set the vertical arrangement image to the edited image it doesn’t show anything :

And in the Internal Storage the image is not here anymore (btw I don’t now how to find the image and i don’t know if it’s findable)

Sorry for the delay I wasn’t home for 4 days :sweat_smile:

your filename looks fine now

what about providing a screenshot of your relevant blocks?

you now have to look into the ASD of the companion app

Taifun

So these blocks are used to pick an image (these blocks work fine now thanks to bodymindpower :pray:)

blocks(5)

This is what happen when the image is picked :
blocks(6)

And these blocks are used to display a resized version of the image in the Vertical arrangement1 :

But the Vertical Arrangement Image return nothing :

any example for the ResultUri you are getting?
is the image editor able to work with result uris?
did you find the file in the ASD meanwhile?

some things to try:
what happens, if you try to display the picked image in the vertical arrangement without scaling it?
are you able to display an image in the vertical arrangement without picking it a) from the assets or b) from shared storage ?

Taifun

So when I do this :
blocks(7)

As you can see in the screenshot below, it returns the image I have chosen so this part works.
(btw you can see that the image is not well framed so I’m cropping it with the image editor component)

When I use this file name it works fine so yes the image editor is able to work with result uris

No but I didn’t look for it (I don’t need to see it actually I just need to delete it after)

You found out, that the vertical arrangement can display result uris… but you still do not know

A result uri is not a filename. .
What about displaying the result uri in a label so we can see how it looks like? You might have to convert it into a filename so the image editor is able to convert it…

You have a strange way of debugging… to check if the file is there and what size it has might help to find the issue…

Taifun

Yes the image editor works fine with result uri because as i’ve told you

This is the result of these blocks :

So, the problem is not on result uri but on the image editor that can’t save the image. Because when I try to edit an image from the assets :
blocks(10)

It returns this :

When I use these blocks :

And this :

When I use these blocks :

So the problem is on the file name

Try a full path to store the fike in ASD
See also

Taifun

I’m sorry but I don’t get it I’ve tried many different ways but I think that the Image_Editor can’t save an image in a specific directory because I’ve tried to save the edited image in a directory that was already created and it did not work.

unfortunately you forgot to provide a screenshot of these blocks, so we do not know, if there is an error in your blocks…
the link in my last answer shows how to store the image in another directory… however nowadays you should not use random directories anymore, use shared storage or ASD…
see again Some basics on Android storage system

Taifun