Wio Terminal as FTP client

Hi,
Is there a an FTP client library for the Wio Terminal? Or is there some example code to allow the Wio to connect to an FTP server to upload data files.

Any Help is much appreciated.

Cheers.

FTPClient_Generic - Arduino Libraries Hello, here is some information you can refer to

Hi @nengyu,
And thanks for the reply.

I did try the FTPClient _Generic library but i couldn’t get it to work, the code and error output is below

The code is based on the example file FTPclient_ListFiles.

The program successfully connects to the local wifi but does not connect to he FTP server. After the call to the ftp.openconnection() method there is a very long delay which i assume is the sytem attempting to make the connection but failing.

Any help is much appreciated.

Cheers.

#include "rpcWiFi.h"
#include "Arduino.h"
#include <FTPClient_Generic.h>
 
const char* ssid = "ssid";
const char* password = "pass";

//  FTP server details
char ftp_server[] = "ftp://ftp.da.da.da/";

char ftp_user[]   = "ftp_user";
char ftp_pass[]   = "ftp_pass";

char dirName[]    = "/";
char newDirName[] = "/Test/";

FTPClient_Generic ftp (ftp_server, ftp_user, ftp_pass, 60000);

 
void setup() {
    Serial.begin(115200);
    while(!Serial); // Wait for Serial to be ready
    delay(2000);

    connectToWifi();
    delay(2000);
    listFTPFiles();
    WiFi.disconnect();    
}
 
void loop() {
 
}

//=====FUnctions=====
void connectToWifi()
{
  // Set WiFi to station mode and disconnect from an AP if it was previously connected
    Serial.println("Setup WIFI Station Mode....");
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(100);
    Serial.println("Setup done");
 
    Serial.println("Connecting to WiFi..");
    WiFi.begin(ssid, password);
 
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.println("Connecting to WiFi..");
        WiFi.begin(ssid, password);
    }
    Serial.println("Connected to the WiFi network");
    Serial.print("IP Address: ");
    Serial.println (WiFi.localIP()); // prints out the device's IP address
}

void listFTPFiles()
{
  Serial.println(F("\nStarting FTPClient_ListFiles"));

  //connect to the ftp server
  Serial.println("Connecting to the ftp server");
  ftp.OpenConnection();

  //Change directory
  Serial.print("Changing to "); Serial.println(dirName);
	ftp.ChangeWorkDir(dirName);

	// Get the file size
	String       list[128];

	ftp.InitFile(COMMAND_XFER_TYPE_ASCII);
	ftp.ContentListWithListCommand("", list);

	for (uint16_t i = 0; i < sizeof(list); i++)
	{
		if (list[i].length() > 0)
			Serial.println(list[i]);
		else
			break;
	}

	//Create a new Directory
	ftp.InitFile(COMMAND_XFER_TYPE_BINARY);
	ftp.MakeDir(newDirName);

	//Enter the directory
	ftp.ChangeWorkDir(newDirName);

	Serial.println("CloseConnection");
	ftp.CloseConnection();
}

error output:

Setup WIFI Station Mode....
Setup done
Connecting to WiFi..
Connected to the WiFi network
IP Address: 192.168.x.xxx

Starting FTPClient_ListFiles
Connecting to the ftp server
Changing to /
[FTP] ChangeWorkDir: Not connected error
[FTP] InitFile: Not connected error
[FTP] ContentListWithListCommand: Not connected error
[FTP] InitFile: Not connected error
[FTP] MakeDir: Not connected error
[FTP] ChangeWorkDir: Not connected error
CloseConnection

It looks like this library is not compatible, I see a project here, maybe the information in it will help you