Envoyer un fichier depuis SD a un serveur ftp

bonjour, j'ai besoin d'envoyer un fichier de données qui se trouve sur une carte SD par un serveur ftp.

le code que j'ai trouvé et un peu adapté ne fonctionne pas, sans donner d'erreur , et je ne comprends pas pourquoi....
voici le code:

#include <SPI.h>
#include <SD.h>  
#include <WiFi.h> 
#include <WiFiClient.h> 
#include <ESP32_FTPClient.h>
#include "octocat.h" 
#include "Secrets.h"

//!!DONT FORGET TO UPDATE Secrets.h with your WIFI Credentials!!

char ftp_server[] = "ftpperso.free.fr";
char ftp_user[] = "xxxxxxtest";
char ftp_pass[] = "0xxxxxx@";


// you can pass a FTP timeout and debbug mode on the last 2 arguments
ESP32_FTPClient ftp (ftp_server,ftp_user,ftp_pass, 5000, 0); // Disable Debug to increase Tx Speed

void setup()
{
  Serial.begin( 115200 );

  WiFi.begin( WIFI_SSID, WIFI_PASS );
  
  Serial.println("Connecting Wifi...");
  while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(".");
  }
  Serial.println("");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  // Init SD Card
  Serial.println("Initializing SD card...");
  if (!SD.begin()) {
      Serial.println("Card Mount Failed");
      return;
  }
 
  // Display Card Size
  uint64_t cardSize = SD.cardSize() / (1024 * 1024);
  Serial.printf("SD Card Size: %lluMB\n", cardSize);


  ftp.OpenConnection();

  // Using File Upload Types:
  // ftp.InitFile("Type A") [ASCII]    and      ftp.InitFile("Type I")    [IMAGE/BINARY]
  // If you can read the whole file in notepad, then type A can be used....
  // Other wise use Type I
  ftp.ChangeWorkDir("Mesures");
  
  // Transfer a file from our SD Card in Binary Mode, which is too big for memory
                                                                    // ::BYTES::
  //readAndSendBigBinFile(SD, "Didge.wav", ftp);                 // 272,546
  //readAndSendBigBinFile(SD, "ESP32_SD_Orth.jpg", ftp);         // 1,629,933
  //readAndSendBigBinFile(SD, "Staff_Finished.jpg", ftp);         // 1,961,969
  //readAndSendBigBinFile(SD, "Staff_ElectroPlating.mp4", ftp);  // 9,369,354
  readAndSendBigBinFile(SD, "testlavande.csv", ftp);            // 32,825,170
  
  ftp.CloseConnection();
}

void loop()
{
}
// ReadFile Example from ESP32 SD Library within Core\Libraries
// Changed to also write the output to an FTP Stream
void readAndSendBigBinFile(fs::FS& fs, const char* path, ESP32_FTPClient ftpClient) {
    ftpClient.InitFile("Type A");
    ftpClient.NewFile(path);
    
    String fullPath = "/";
    fullPath.concat(path);
    Serial.printf("Reading file: %s\n", fullPath);

    File file = fs.open(fullPath);
    if (!file) {
        Serial.println("Failed to open file for reading");
        return;
    }

    Serial.print("Read from file: ");
    
    while (file.available()) {
        // Create and fill a buffer
        unsigned char buf[1024];
        int readVal = file.read(buf, sizeof(buf));
        ftpClient.WriteData(buf,sizeof(buf));
    }
    ftpClient.CloseFile();
    file.close();
}

voici ce qu'il y a dans mon moniteur:

08:20:46.341 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
08:20:46.341 -> configsip: 0, SPIWP:0xee
08:20:46.341 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
08:20:46.341 -> mode:DIO, clock div:1
08:20:46.341 -> load:0x3fff0030,len:1344
08:20:46.341 -> load:0x40078000,len:13924
08:20:46.341 -> ho 0 tail 12 room 4
08:20:46.341 -> load:0x40080400,len:3600
08:20:46.341 -> entry 0x400805f0
08:20:47.198 -> Connecting Wifi...
08:20:47.687 -> ......
08:20:50.202 -> IP address: 192.1x8.1.xx
08:20:50.202 -> Initializing SD card...
08:20:50.202 -> SD Card Size: 968MB
08:20:54.564 -> Reading file: H��?
08:20:54.564 -> Read from file:

voilà le moniteur s'arrête comme ça... il ne se passe plus rien

quelqu'un peu t il m'aider?

PS: le fichier original etait pour transferer des fichier images

merci pour tes conseils....j'ai appliqué les modif mais ça fait pareil.....

pourtant la piste me semblais bonne, le script semble cohérent avec mon besoin..

tu aurais une idée à me proposer?

déjà à cette ligne il y a que chose qui ne va pas (le moniteur affiche Reading file: H��? )

oui en effet c'est bizarre... mais aucune idée.
je ne l'ai pas annoncer au début du sujet mais je suis très débutant .
Je vais essayer de trouver un autre script plus simple.

y' a peut etre celui là:

je vais l'explorer.