Post a file to your server in the Internet with a textfile

Thanks again for your help.
But when I install only the apk on a new phone there doesn't exist any

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3
folder. So which folder can I use instead? kindly regards

There may not be an ASD folder to start with (that will contain your package name) e.g. (/storage/emulated/0/Android/data/com.mendhak.gpslogger/files/).
You may have to create this using the extension block provided.

Another way to create the ASD, if you have the File component loaded, is to create a dummy file:

saveFile
text: ""
filename: /dummy.txt

Hi!
I don't understand what you mean in your last post.

When I install the gpslogger on anew phone the folder you mention

/storage/emulated/0/Android/data/com.mendhak.gpslogger/files/

exist.

I think with the second way you mean I should create the asd folder

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files

I have test it and copy a gpx file to this created folder.
I can put now this file to my ftp. I have tested on my phone with companion but I think it can also work on a new phone without companion or?

Only I will get an error "File is empty" when I use the postfileV2.
I don't know why but I can deactivate this message in php.

kindly regards

This folder is created by the companion app. It is not provided for use with compiled apps and will not exist on devices that have not been used for App Inventor development. You should ignore this folder when working with a compiled app. If this confuses you, then delete this folder, any subfolders and the files in it before you install and run your compiled app.

Alternatively, use a different device that you do not use for development, for your compiled apps.

I have test it now on a new phone and there doesn't exist the edu.mit.appinventor.aicompanion3 folder.

Which folder can I use now to upload the gpx files from /storage/emulated/0/Android/data/com.mendhak.gpslogger/files/
Because otherwise I will get the error?
kindly regards again

Yes, that is your application specific directory for you app.

Thanks again.
How can I use the specific directory for my app?
With android 10 I cannot upload files from

/storage/emulated/0/Android/data/com.mendhak.gpslogger/files/`

kindly regards

Try giving write permission (also gives read permission)

These blocks work for me ( I copy the file first from assets to the ASD then upload)

Thanks for your answer.
Which extension do you use because in my extension of TaifunFile I don't have a call TaifunFile.ApplicationSpecificDirectory.
May you can send me the extension.
kindly regards

Oh sorry.
I think I use an old taifunfile.
I must download the new version and then I try it again.
kindly regards

Hi!
Thanks a lot for your help and patience with me.
It works now with the ApplicationSpecificDirectory.
kindly regards

Yay !! :+1:

Hi!
I have one more question.
When I do TaifunFile1.copyasync to the TaifunFile1.ApplicationSpecificDirectory I think this folder will grow up always when I do a copy.
How can delete all file in this ApplicationSpecificDirectory when I have done the upload.
kindly regards again

Hi!
I think I have used the wrong block.
I used first TaifunFile1.Copy -> there the files will copy also the file into the ApplicationSpecificDirectory.
With TaifunFile1.CopyAsync -> there will not copy the file into the ApplicationSpecificDirectory.
kindly regards

Both methods will copy files where you want to copy them, the async method helps with larger files and collections of files because it does not interupt the program flow. The async method also provides you with an afterCopying event which you can use when the entire copy function is complete.

Not sure why you want to delete the files you have just copied over ?

There is a File.Delete method in the File component (or in TaifunFile) which will allow you to delete files. A single slash / before the file name will provide the file path for files in the ASD

Hi!
I have one more problem.
Here my project:

The problem ist, when I have one than more files which the datum < aktdatum only one file will be delete with the function löschen.
Hope someone can help me there
kindly regards

Hi!
I check the code again.
The problem is when I have no internetconnection there will no file upload but the files will be deleted.
My idea is when I upload the file it should deleted on the phone.

When I deactivate the internet connection I will get Error1101 and Error1104.


How can I check this error so that no file will delete after I get this error.

kindly regards

You would like to check this:

Thanks for the answer.
I could add this network extension.
Here my complete project:

I noticed an further problem.
When I test it with some more files with the companion I will never get a problem or error.

But when I use the build apk I will get always an error with the first file in the listview.
Here my listview of three files:

When I start the app I will get this error:

The next files will update without any problem but not the first one.
I will search now the whole day for the error but couldn't find it.

Hope someone can help me there again.
kindly regards for any further answer.

Hi!
It seems that I will not work in my project.
Can you informe me where can I find the asstes folder?
How can I gives the read permission?
I will try your example.
I think I mus press first the button2 then button1?
kindly regards again for your help