Illegal Character In Path At Index... How to save canvas

Okay thank you for the additional resources.

How do I then save my image it into one of those directories which don't have a space in the title?

1 Like

Can someone please help if they have the solution? I'm sure it is a simple solution but I am struggling to find the answer

This should work for you, it will save the canvas image to the ASD (application specific directory)

image

in companion the path returned is:

file:///storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3
/files/mycanvas.jpg

in compiled app the path should be

file:///storage/emulated/0/Android/data/<package_name>
/files/mycanvas.jpg

Thanks for the reply! I tried this and although the App gave no errors and seemingly saved the file to the storage location the image was nowhere to be found under the given directory. Searching the phone for the image name also revealed no results :frowning:

At this point I am really unsure of what I could do to try and get this image saving to work and it seems that AppInventor just doesn't allow for this functionality in any accessible way. But if anyone has any further ideas or ways to get this working please let me know!

Post the aia or a test aia.

Working_Device_List.aia (293.8 KB)

Here is my aia. I tried using the full filename as specified by @TIMAI2 but then in this version just used the filename "/mycanvas.jpg". I think this version is correct but maybe I am wrong.

I really appreciate the help and support given with regards to my problem. You guys and girls are heroes

Try this app (save image → ASD):

Screenshot

Is there any chance you could share the .aia file for this app that I could upload to my phone as a .apk? If not I am sure I can get this app on my phone but it would be easier through the .aia

Nevermind it was very easy installing it directly from the .apk

When using this app it appears to save the image but then when I folder dive on the android through storage/emulated/0/android/data/ I do not see the folder which I believe should have been created by the app. Once again doing a deep search of the phone the saved image / file does not come up...

Is this a problem with how I am diving through the android directories? At the end of the day I would also like the files to be saved in an accessible folder for the more novice user

The ASD is no longer visible on Android 11+ devices. Connect you device via USB with your computer and you will see it. Or use a file manager app (e.g. Total Commander) to get access to the ASD. Search the forum, there are a lot of topics on this ...

2 Likes

If that is the case I think I will not try and implement this functionality within my app as it just seems to cumbersome, but thank you so much for the help and I feel satisfied knowing that I really tried to get it to work :slight_smile:

You have not said what it is you want to do with your image once you have created it....

You can save the image (canvas) also in one of the Shared folders (e.g. /Documents /Download, /Pictures or ...):

Set DefaultFileScope to Shared in the Designer.

See also here:

I just want to be able to save the image in order to view it in the future.

On the app, or just on your phone?

If on the app, then you have the url to the image, save this to a list, then you can call it back and display it in an image component or in your canvas

If on the phone then see @Anke's method above.

If you want to view your image/s elsewhere, then there are many methods for uploading your image to an online resource for later use (you can also call these back to your app if you wish.

I get this error when attempting to save using the directory as specified above

As I said:

grafik

2 Likes

Thank you so much! I did not see the comment mentioning to change the DefaultFileScope and after changing that my images save perfectly :slight_smile:

1 Like

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