App Inventor Extensions


FTP Extension

See the App Inventor Extensions document about how to use an App Inventor Extension.

For questions about this extension or bug reports please start a new thread in the App Inventor community. Thank you.

For feature requests please contact me by email. To be a sponsor of a new method already is possible starting from only 10 USD! With your contribution you will help the complete App Inventor community. Thank you.

Dec 14th, 2015: Version 1: Demo version of the FTP Extension released

Jun 7th, 2016: Version 2: possibility added to upload japanese filenames, one file only download option added

Jun 21th, 2016: Version 3: create remote directory method added

Aug 11th, 2016: Version 3a: avoid DX execution failed error: build each extension separately

Oct 16th, 2016: Version 3b: bugfix use parameter UseFileTypeBinary for downloading files, too

Nov 9th, 2016: Version 4/4a: method RemoteFileNames added, missing permissions added

Jan 27th, 2017: Version 5: method Delete and Rename added

Jan 9th, 2020: Version 6: method RemoveDirectory added

Dec 13th, 2021: Version 7: method RemoteDirectories added and library update to Apache Commons Net 3.8.0

Description

This extension enables you to upload or download files to/from your server via FTP - File Transfer Protocol.
Required permission: android.permission.READ_EXTERNAL_STORAGE, android.permission.WRITE_EXTERNAL_STORAGE

Probably you want to read this first: What is FTP?
This extension uses the Apache Commons Net 3.8.0. library. Thank you Apache Software Foundation!

Properties


Returns server address.


Specifies server address.


Returns user id.


Specifies user id.


Returns password.


Specifies password.


Returns whether filetype binary should be used for upload/download, alternatively filetype ASCII will be used.


Specifies whether filetype binary should be used for upload/download, alternatively filetype ASCII will be used. Default is true.

Methods


Download one or all files from remote directory into local directory on SD card.
In case the local directory does not exist, it will be created. If the localDirectoryName starts with file:/// you can specify a complete path for example to download to the external SD card.
To download all files from a remote directory, use an empty string as remoteFileName.
Thank you Noguchi for being the sponsor of the one file only download option.


Upload file to remote directory.
Prefix the filename with / (i.e. relative path) to upload a file from the SD card. For instance /myFile.txt will upload the file /mnt/sdcard/myFile.txt. To upload assets packaged with an application does not make sense and has been disabled therefore. If a fileName starts with file:/// you can specify a complete path to the file.


Create remote directory.
Always begin the remote directory name with a forward slash to create a directory in the server's root directory.


Get filenames of remote directory.


Delete remote file.


Rename remote file.


Remove remote directory (if empty). Always begin the remote directory name with a forward slash to remove a directory relative to the server's root directory.


Get directories of a remote directory.

Events


Event indicating that a download has finished.
If Download was successful, the flag "successful" is true and the list of the downloaded files are provided in the response. In case of an error, flag "successful" is false and the error message is provided in the response.


Event indicating that an upload has finished.
If Upload was successful, the flag "successful" is true and the message "successfully uploaded" is provided in the response. In case of an error, flag "successful" is false and the error message is provided in the response.


Event indicating that creating a directory has finished.
If creating the directory was successful, the flag "successful" is true and the message "directory successfully created" is provided in the response. In case of an error, flag "successful" is false and the error message is provided in the response.


Event indicating that remote filenames haven been received.
Parameter successful indicates true (successful) or false.
Parameter response contains the list of available files or in case of an error the error message


Event indicating that deleting is finished.
Parameter successful indicates true (successful) or false. Parameter response provides success message or error message.
See here for possible server reply codes.


Event indicating that renaming is finished.
Parameter successful indicates true (successful) or false. Parameter response provides success message or error message.
See here for possible server reply codes.


Event indicating that removing a remote directory has finished.
Parameter successful indicates true (successful) or false. Parameter response provides success message or error message.
See here for possible server reply codes.


Event indicating that getting remote directories has finished.

Example App: FTP Demo

Add your server address, user id and password to upload or download files to/from your server to test the functionality of the FTP extension.

How to check, if a specific file is available on the remote server?


How to delete or rename a remote file


How to remove a remote directory


Screenshots:

Questions and Answers

Q1: Can I download only one file from the remote folder? Because, I do not want to download all the files from the remote folder.
A: I now added that option in the Download method.

Q2: If I want to "Make directory in FTP" it is possible with this extension?
A: I now added a new method "create directory".

Q3: Is it possible to use this extension as FTP server?
A: No, your App Inventor app together with the FTP extension can be used only as client. For FTP server solutions, see these apps in Google Play.

Q4: I would like to know if there is any way to delete the files from my ftp server?
A: I now added a new method "delete" and "rename".

Q5: I have this error: Error during login: recvfrom failed: ECONNRESET (Connection reset by peer) Can you help me to solve it?
A: Sorry, unfortunately I don't know what the problem might be. Did you try a Google Search? I only can suggest to use another ftp server instead.

Q6: I was wondering if your FTP Extension supports SFTP connexions.
A: I'm sorry, but SFTP is not supported. You might want to use Andres' SFTP Manager Extension.

Q7: I need to change default port 21 to another port. How can I do?
A: Only port 21 is available. All other protocols like SFTP or FTPS are not supported.

Q8: I'm using the FTP extension and it is very good. Just I want to know if we can transfer more than one file simultaneosly?
A: The extension does not support this. Uploading several files simultaneously does not have any speed advantage compared to uploading the files one by one. Therefore upload the first file and after the upload is done (AfterUpload event) then upload the next file etc. See the File by File example how to set up the logic. That example downloads file by file, just adjust that logic to your needs to upload file by file...

Q9: I get the error message "Error during login: check userid and password", but it is correct, it is the same as I used in Filezila?
A: Make sure, your server supports FTP together with port 21. Only port 21 is available! All other protocols like SFTP or FTPS are not supported.

Q10: Any tip for upload files (path, etc) in Android 11?
A: Starting with SDK30 you have to follow the Android file and directory restrictions, see also the overview here. Let me suggest you to upload files from the ASD - application specific directory.

For questions about App Inventor,
please ask in the App Inventor community.Thank you.

Test the functionality of the FTP extension

The test app is available in Google Play. You can test the example following these steps

  1. Follow the opt-in URL to get access to the app and to be able to download it to your device. It might take a few hours for Google to enable you as beta tester!
  2. Start testing.

Buy the FTP extension for App Inventor


You can buy this extension (aix file).
With your payment you accept the terms and conditions below.

Payment options

1. Paypal

Please transfer 12 USD via Paypal
to Pura Vida Apps

2. Bitcoin

After having received your payment I will be happy to send the download link to you. Please let me know your Google account! I usually will send the download link not later than 24 hours after having received your payment.
Thank you! Taifun


Terms and Conditions

Back to top of page ...


Home | Snippets | Tutorials | Extensions | Links | Search | Privacy Policy | Contact