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

I have tried the example from with a picture and it works fine.

How can I do this with a textfile.

kindly regards for any answer

Have you tried a text file in just the same way as an image file?

But in the image picker I can only choose an image.
Also I use the taifunfile object to search for all files from a folder which I want to upload to an server.
Here my start code:

Hope someone can still help me there.
kindly regards

OK, nearly there.

In your Listview AfterSelecting set the selection to the path socket in the POSTFILE block. You may have to do some work on the file path if it doesn't work e.g.

Absolute Path = file:///storage/emulated/0/mytext.txt
Full Path = /storage/emulated/0/mytext.txt
Relative Path = /mytext.txt 

Depending on your Android version/target, you may have to get the ASD (application specific directory)

In my opinion this is the easiest way:


To avoid WRITE/READ permissions you can also use the EFile extension from @vknow360 instead of the File component:

1 Like

No, this is not sending a php request, which is what the OP asked for.

No, he asked (his topic is):
Post a file to your server in the Internet with a textfile.

He only said that he tried the example from ...

No, you don't POST using FTP....

Thanks for the answers.
I tried now the following function:

In my opinion it should the same as in the example with a picture from

But I will get the following error:

Hope someone can still help me there.
kindly regards

Is your strPath correct ?

my strpath is correct.
I changed it here in the post.
kindly regards

Using my php POST file setup I tested your filename, that works OK for me, so unlikely to be that.

Were you able to post an image file to the same server ?

Use Do It to check all your variables?

Perhaps simplify, if you do not need PEAR:

Thanks for your answer.
All variable are correct.
I also tried your php.
I think it is not a problem of the php but in appinventor.
I have tried again the appinventor which will work with a picture.
There I change the
the path is a file direct from the phone.
then I will get the error.
When I use the ImagePicker1.Selection all is fine.
Hope someone can still help there.
kindly regards

Show your image picker selection path....

Thanks again for your answer.
Here the image picker selection path:

kindly regards

and you are saying that that path :


to a file works and uploads the file ?

but if you replace that path with a path like this:


then it doesn't work ?

This link will work:


But this link will not work


or the following link for an textfile will also not work:


kindly regards

You probably don't have access to this directory on a +10 Android device ?

Are you trying this with a compiled app or in companion (it won't work in companion)

I tried it with companion and as compiled app with the right to use the storage.
But I will get always the same error.
kindly regards

I believe your problem to be with file access locations on the app and not with your php code.

I suggest you move all your files into the ASD where you know they will work.

Use Taifun's File extension to move your files