peterus / ESP-FTP-Server-Lib

MIT License
25 stars 12 forks source link

put file to server leads in target file 0 byte #53

Open FredericMetz opened 2 months ago

FredericMetz commented 2 months ago

Hi, I like the integration and your ftp server. Unfortunately, I try to connect to the server on the ESP32, the use put to put the file on the server. The file is afterwards present on the SD card, but it has 0 Bytes.

Any help appreciated, I would really like to integrate it into my project.

Program I use:

#if defined(ESP32)
#include <SD.h>
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#include <FS.h>
#endif

#include "ESP-FTP-Server-Lib.h"
#include "FTPFilesystem.h"

#define WIFI_SSID     "net"
#define WIFI_PASSWORD "pw"

#define FTP_USER     "ftp"
#define FTP_PASSWORD "ftp"

#ifndef UNIT_TEST
FTPServer ftp;

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

  if (!SD.begin(5)) {
    Serial.println("SD Card Mount Failed");
  }

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

  ftp.addUser(FTP_USER, FTP_PASSWORD);
#if defined(ESP32)
  ftp.addFilesystem("SD", &SD);
#endif
  ftp.begin();
  Serial.println("...---'''---...---'''---...---'''---...");
}

void loop() {
  ftp.handle();
}
#endif
qiweimao commented 1 month ago

I have the exact same problem. But it is not always 0, sometimes it goes through and actually store the file.