Send txt. file to FTP server with external connexion

Hello ! I need your help…

I would like create txt. or cvs. file and send that in my FTP server.

When I use file extension for that, the problem It’s when I put for example “/test.txt”, this file is public.
And I know, when I put “test.txt”, this file is private. But how can I get this private file with a path ?

try this

/storage/emulated/0/Android/packageName/files

does not works…

Try this

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

In my opinion I prefer using @Taifun’s file extension, it’s more reliable.

/Boban

3 Likes

Hello boban,

I tried : /storage/emulated/0/Android/data/com.example.test/Test.txt , but does not works…

And I try with the file extension, and does not works again.

But i don’t know if it’s OK.

Companion live path /storage/emulated/0/Makeroid/data/

bild

Make use of this block
bild

Try out something and see what happens

/Boban

will be your package name

/Boban

OK, When i try with companion live. It’s OK !!!

But when i use android app. Does not works…

Just tried and it looks like the file is not saved in the private storage

If I copy the file from /storage/emulated/0/Makeroid/data/ to private storage, then it works

@KodularCreator something to take a look at

Btw, you shold use it like this

/Boban

I tried that too and it still does not work.
It’s strange.

image

Yes it is,

Tried this also at MIT AI2 but even there it doesn’t work

If the filename does not start with a slash, it will be written in the programs private data directory

This is my only workaround that works, either you write the entire path or if you use it like this so you don’t have to think about package name

/Boban

1 Like

It’s works !!! But the block “replace all text” doesn’ntwork with “applicationSpecifiqueDirectory”.

And there is a strange thing :

  • When i use my app with Wifi, it’s work !
  • But when i use my app with my phone connexion (4g), i’m connected
    with my FTP server, but the file don’t want send…

Well…
after to try again… now “Error 2103 : The file /storage/emulated/0/Android/data//files /test.txt could not be created” :sob:

Use doit to troubleshoot your code, tip 4 App Inventor: How to Learn | Pura Vida Apps

Is your mobile data on

There is something missing and that you have spaces, don’t know if it’s mistyped…

Btw, no point opening a new thread with the same thing Problem for create txt. or cvs. private file. and send ftp server

/Boban

After some research, I have installed the filezilla software that can turn my PC into FTP server.

I think to found the problem, but not the solution…. :

  • FTP can be used in two different ways :

    • image

      In active mode, it is the FTP client that determines which connection port to use to enable data transfer. Thus, for the exchange of data to be done, the FTP server will initialize the connection of its data port (port 20) to the port specified by the client. The client will then have to configure his firewall to allow new incoming connections so that data exchange takes place. In addition, it can be problematic for users trying to access FTP servers when these users are behind a NAT gateway. Given how NAT works, the FTP server initiates the data connection by connecting to the external NAT gateway address on the chosen port. Some NAT gateways have no match for the received packet in the state table, the packet will be ignored and will not be delivered to the client.

    • image

      In passive mode, the FTP server itself determines the connection port to be used to enable the data connection and communicates it to the client. If a firewall is present in front of the server, it must be configured to allow the data connection. The advantage of this mode is that the FTP server does not initialize any connection. This mode works well with clients behind a NAT gateway. In new implementations, the client initializes and communicates directly through port 21 of the server; this simplifies server firewall configurations.

  • NAT

    In a computer network, a router is said to make network address translation (NAT) when it maps IP address to other IP address. In particular, a common case is to allow machines with address that are part of an intranet and are neither unique nor routable across the Internet, to communicate with the rest of the Internet by pretending to use unique and routable external address.

Well… Here are my parameters :

  • My setting router (In French) :

    image

  • My setting server in FileZilla :

    Capture

    Capture2

And when I try my app :

If anyone can help me, it would be super nice !! :hugs::grin:

This post was flagged by the community and is temporarily hidden.

no problem, thank’s !

Well … I tried on another FTP application, and there is a passive and active mode.
When I am in LAN, both modes work.
But with in WAN, only the passive mode works.

This is the Kodular extension that does not use passive mode …

This is a real problem …

Thank’s very much Francis ! :slightly_smiling_face:

So… I can’t create my application in WAN …
Is there another way to use my app with a private server in WAN ?

Screenshot_11
Hello! Where this block is?

you can find it in the file extension
https://puravidaapps.com/file.php
Taifun

1 Like