I am following along with this tutorial here:
Upload Any File To Google Drive with AI2 by TIMAI2 (Thanks Tim!)
…and have got it working. I am able to upload an image from AI2 media assets to my google drive. I have successfully created the web app script, etc. Great, awesome, it works, it’s amazing!
However, I am now trying to adapt it to work with some other file that does not already exist in assets (an image taken with the camera, for example).
Using TaifunFile, I am able to get a list of files and find an image from a specific directory on my phone, lets say:
I know this is a valid file path because I can use this path to display the photo on my app, using:
set image1.picture to file:///sdcard/DCIM/Camera/IMG_20200609_205137306.jpg
However, I have not figured out how to format this path/file to get it to upload to the drive like a media asset file. In the image below, only “troll.jpg” will upload (troll.jpg is preloaded into the media assets of the app).
The others give the following error:
java.io.FileNotFoundException: /storage/emulated/0/AppInventor/assets/sdcard/DCIM/Camera/IMG_20200609_205137306.jpg (No such file or directory)
which shows how the file path is getting mangled. The original tutorial indicates there is a way to upload files from the virtual SD card. Is this different than the phone’s SD card? Is there a way to upload a file from phone storage and what is the correct path/file formatting for KIO4_Base641 fileExtension?
Just started using AI2. Thank you for any pointers you can provide!