Failed Upload File with Http Post using ESP8266 from SD

I want to upload an Image from my Arduino UNO (WeMos D1) which embedded ESP8266. I want upload the image to my hosting (server), but it fails.

Here the Arduino code.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <SD.h>
#include <SPI.h>
//#include "FS.h"

const char* ssid     = "nameSSID";
const char* password = "passwordSSID";

File webFile;
char servername[] = "myhost";
WiFiClient client;

unsigned long laikas;

#define MTU_Size    2*1460  // this size seems to work best

// file sending from SD card
byte clientBuf[MTU_Size];
int clientCount = 0;
int progresas = 0;
int zenklas   = 0;
int zenklas2   = 0;

// change fileName to your file (8.3 format!)
char fileName[13] = "IMAGE19.JPG";

void setup() {
  Serial.begin(115200);
  // We start by connecting to a WiFi network

  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.print("WiFi connected,");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(rssi); 
  
  if (!SD.begin(15)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }

/** part of timing only to check how long to read file takes  */
  laikas = millis();

  webFile = SD.open(fileName,FILE_READ);
  while(webFile.available())
  {
    if (webFile.available()>= MTU_Size){
      clientCount = MTU_Size;
      webFile.read(&clientBuf[0],clientCount);
    }else{
      clientCount = webFile.available();
      webFile.read(&clientBuf[0],clientCount);
    }
    if(clientCount > 0)
    {
      //client.write((const uint8_t *)&clientBuf[0],MTU_Size);
      clientCount = 0;
    }
  }
  webFile.close();
  laikas = millis() - laikas;
  //prints time since program started
  Serial.println(laikas);
/** END of read file test time   */

  laikas = millis();
  webFile = SD.open(fileName,FILE_READ);
  //SIUNTIMAS (POST) HTTTP
    if (client.connect(servername, 80)) {
      client.setNoDelay(true);
      Serial.println("Connected to Server");

      laikas = millis();
      // Make a HTTP request:

      client.println("POST /page.php?azyx=1&d=1 HTTP/1.1");
      client.println("Host: myhost");
      client.println("Connection: close");
      client.println("Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryjg2qVIUS8teOAbN3");
      client.print("Content-Length: ");client.println(webFile.size()+196);  //+196 is owerhead form boundary tags
      client.println();
      client.println("------WebKitFormBoundaryjg2qVIUS8teOAbN3");
      client.println("Content-Disposition: form-data; name=\"FileGDF\"; filename=\"IMAGE19.JPG\"");
      client.println("Content-Type: application/octet-stream");
      client.println();
      //Serial.println(F("Writing"));
  progresas = 0;   
  while(webFile.available())
  {
    if (webFile.available()>= MTU_Size){
      clientCount = MTU_Size;
      webFile.read(&clientBuf[0],clientCount);
    }else{
      clientCount = webFile.available();
      webFile.read(&clientBuf[0],clientCount);
    }
    if(clientCount > 0)
    {
      client.write((const uint8_t *)&clientBuf[0],clientCount);
      progresas += clientCount;
      clientCount = 0;
      // some kind of progress output
      zenklas = (progresas * 100)/webFile.size();
      if (zenklas != zenklas2){
        zenklas2 = zenklas;
        Serial.print(".");
      }
      // end of progress output
    }
  }
  client.println();//file end

/** if another field required it can be started here **/
//      client.println("------WebKitFormBoundaryjg2qVIUS8teOAbN3");
//      client.println("Content-Disposition: form-data; name=\"okey\"");
//      client.println();
//      client.println("SEND");
      client.println("------WebKitFormBoundaryjg2qVIUS8teOAbN3--"); //form end
      client.println();
      webFile.close();
      Serial.println("done");
    }
  laikas = millis() - laikas;
  //prints time since program started
  Serial.println(laikas);
  if(!eRcv());
  client.stop();
}

void loop() {
}

byte eRcv()
{
  byte respCode;
  byte thisByte;

  while(!client.available()) delay(1);
  respCode = client.peek();
  while(client.available())
  {  
    thisByte = client.read();    
    Serial.write(thisByte);
  }
  return 1;
}

And here the PHP code that I put in the server

<?php
$target_dir = "uploads/";
$filename = basename(@$_FILES["FileGDF"]["name"]);
$target_file = $target_dir . $filename;
$uploadOk = 0;
$FileType = pathinfo($target_file,PATHINFO_EXTENSION);

if(isset($_GET["azyx"])&&(isset($_GET["d"]))) {
  if (file_exists($target_file)) {
    if (file_put_contents($target_file,file_get_contents(@$_FILES["FileGDF"]["tmp_name"]))){
      echo "The file ". $filename. " has been uploaded.
";
      $uploadOk = $uploadOk + 1;
    } else {
      echo "Sorry, there was an error uploading your file1.
";
    }
  }else{
    if (move_uploaded_file(@$_FILES["FileGDF"]["tmp_name"], $target_file)) {
      echo "The file ". basename($filename). " has been uploaded.
";
      $uploadOk = $uploadOk + 1;
    } else {
      echo "Sorry, there was an error uploading your file2.
";
    }
  }
}
?>

After I execute the code, it always change to “Content-Type: text/html” and show "Sorry, there was an error uploading your file2.
"

Please help me finish this project.
Thank you in advance.

what is an

Arduino UNO (WeMos D1)

?? UNO is something, WeMos D1 is something totally different… do you mean “ESP-12E WeMos D1 WiFi uno”

J-M-L: what is an ?? UNO is something, WeMos D1 is something totally different... do you mean "ESP-12E WeMos D1 WiFi uno"

Yes, that's what I mean, sorry. do you know the problem of my code?

Well why do you go twice through your file ? First time in pure waste and without sending anything but moving the read cursor at the very end so that when you get to the second time you have nothing left to read in your file…

I’ve not checked the rest but this seems bad enough so you should fix that first

J-M-L:
Well why do you go twice through your file ? First time in pure waste and without sending anything but moving the read cursor at the very end so that when you get to the second time you have nothing left to read in your file…

I’ve not checked the rest but this seems bad enough so you should fix that first

I try modified as you suggestion, become like this

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <SD.h>
#include <SPI.h>
//#include "FS.h"

const char* ssid     = "mySSID";
const char* password = "myPassword";

File webFile;
char servername[] = "mydomain";
WiFiClient client;

unsigned long times;


#define MTU_Size    2*1460  // this size seems to work best

// file sending from SD card
byte clientBuf[MTU_Size];
int clientCount = 0;
int progress = 0;
int zenklas   = 0;
int zenklas2   = 0;

// change fileName to your file (8.3 format!)
char fileName[13] = "IMAGE18.JPG";

void setup() {
  Serial.begin(115200);
  // We start by connecting to a WiFi network

  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.print("WiFi connected,");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(rssi); 
  if (!SD.begin(15)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;   
  }

  times = millis();
  webFile = SD.open(fileName,FILE_READ);
  //SIUNTIMAS (POST) HTTTP
  
  if (client.connect(servername, 80)) {
    client.setNoDelay(true);
    Serial.println("Connected to Server");

    times = millis();
    // Make a HTTP request:

    client.println("POST /page.php?azyx=1&d=1 HTTP/1.1"); //send new page
    client.println("Content-Type: image/jpeg");
    progress = 0;   
    while(webFile.available()){
      if (webFile.available()>= MTU_Size){
        clientCount = MTU_Size;
        webFile.read(&clientBuf[0],clientCount);
      }
      else{
        clientCount = webFile.available();
        webFile.read(&clientBuf[0],clientCount);
      }
      
      if(clientCount > 0){
        client.write((const uint8_t *)&clientBuf[0],clientCount);
        progress += clientCount;
        clientCount = 0;
        // some kind of progress output
        zenklas = (progress * 100)/webFile.size();
        if (zenklas != zenklas2){
          zenklas2 = zenklas;
          Serial.print(".");
      }
      // end of progress output
      }
    }
    client.println();//file end

    /** if another field required it can be started here **/
    //client.println("------WebKitFormBoundaryjg2qVIUS8teOAbN3");
    //client.println("Content-Disposition: form-data; name=\"okey\"");
    //client.println();
    //client.println("SEND");
    client.println("------WebKitFormBoundaryjg2qVIUS8teOAbN3--"); //form end
    client.println();
    webFile.close();
    Serial.println("done");
  }
  times = millis() - times;
  //prints time since program started
  Serial.println(times);
  if(!eRcv());
  client.stop();
}

void loop() {
}

byte eRcv(){
  byte respCode;
  byte thisByte;

  while(!client.available()) delay(1);
  respCode = client.peek();
  while(client.available())
  {  
    thisByte = client.read();    
    Serial.write(thisByte);
  }
  return 1;
}

The result print the “Done”, but the file doesn’t appear in the server.
Could you help me about the code? actually copy paste this from another page here

I don't think your POST request is properly formatted

J-M-L: I don't think your POST request is properly formatted

Hm, so what the problem then? I still confuse about your point

Did you check what a POST HTTP request looks like? Did you compare with what you submit?

It is something like this

POST /upload.php HTTP/1.1
Host: richiewijaya.esy.es
Connection: close
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryjg2qVIUS8teOAbN3
Content-Length: 3648 + 196

------WebKitFormBoundaryjg2qVIUS8teOAbN3
Content-Disposition: form-data; name=\"FileGDF\"; filename=\"IMAGE19.JPG\"
Content-Type: application/octet-stream
//Some code
client.write((const uint8_t *)&clientBuf[0],clientCount);

------WebKitFormBoundaryjg2qVIUS8teOAbN3--"

But it the server said “Content-Type: text/html; charset=UTF-8”, but I don’t use that content-type.
Can you help me what is wrong?

Try to print as well to the console the header you are sending to the client - see if it looks like that

J-M-L: Try to print as well to the console the header you are sending to the client - see if it looks like that

After the "Content-Type: application/octet-stream", it failed to upload. Maybe i'll try upload using FTP

I would use FTP to upload files https://playground.arduino.cc/Code/FTP

richiewijaya: After the "Content-Type: application/octet-stream", it failed to upload. Maybe i'll try upload using FTP

is #8 what you see or what you think it should look like?

what does it really looks like?

horace: I would use FTP to upload files https://playground.arduino.cc/Code/FTP

It is uploaded using File System, do you know FTP but uploaded using SD?

J-M-L: is #8 what you see or what you think it should look like?

what does it really looks like?

This is what it looks like. Do you think is fail in the server or what?

12345 is when the arduino read the file. I add serial print in the loop.

POST /upload.php HTTP/1.1
Host: richiewijaya.esy.es
Connection: close
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryjg2qVIUS8teOAbN3
Content-Length: 3844

------WebKitFormBoundaryjg2qVIUS8teOAbN3
Content-Disposition: form-data; name="FileGDF"; filename="IMAGE19.JPG"
Content-Type: application/octet-stream
1
2
4
5
.1
3
4
5
.
------WebKitFormBoundaryjg2qVIUS8teOAbN3--

done
6707
HTTP/1.1 200 OK
Date: Thu, 01 Feb 2018 15:32:55 GMT
Server: Apache
X-Powered-By: PHP/5.6.21
Content-Length: 46
Connection: close
Content-Type: text/html; charset=UTF-8

Sorry, there was an error uploading your file.

richiewijaya:
It is uploaded using File System, do you know FTP but uploaded using SD?

the sample code
https://playground.arduino.cc/Code/FTP
uploads the file char fileName[13] = “test.txt”; from SD to the FTP server
the code uses ethernet but should be easy to modify to use ESP8266

e.g. to run on a WeMos D1 ESP8266 device
this uploads a file test.txt to an FTP server no SD device it just sends some text to put in the new file

/*
   FTP passive client for IDE v1.0.1 and w5100/w5200
   Posted October 2012 by SurferTim
   Modified 6 June 2015 by SurferTim

  adapted to run on a WeMos D1  ESP8266 device
   
*/

// WiFiexample to send a single line file

#include <SPI.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266mDNS.h>

//#define SPRINTF       // comment out to use strcat() 

// update for your WiFi
const char* ssid = "horacexxxx";
const char* password = "zzzzzzzz";

// change to your server
IPAddress server( 192, 168, 1, 96 );

WiFiClient client;
WiFiClient dclient;
int status = WL_IDLE_STATUS;     // the Wifi radio's status

char outBuf[128];
char outCount;

// fileName to your file (8.3 format!) and file 
char fileName[13] = "test.txt";
char clientBuf[64]="hello from ESP-01 1234567890";  // file to send
int clientCount = strlen(clientBuf);


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

  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }


  // attempt to connect to Wifi network:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, password);

    // wait 10 seconds for connection:
    delay(10000);
  }

  // you're connected now, so print out the data
  Serial.println("You're connected to the network");
  
  printWifiStatus();  delay(2000);
  Serial.println(F("Ready. Press f"));
}

void loop()
{
  byte inChar;
  inChar = Serial.read();
  if(inChar == 'f')
  {
    if(doFTP()) Serial.println(F("FTP OK"));
    else Serial.println(F("FTP FAIL"));
  }
}


byte doFTP()
{
  if (client.connect(server,21)) {
    Serial.println(F("Command connected"));
  } 
  else {
     Serial.println(F("Command connection failed"));
    return 0;
  }
  // send login name and password
  if(!eRcv()) return 0;
  client.println(F("USER horace"));
  if(!eRcv()) return 0;
  client.println(F("PASS horace"));
  if(!eRcv()) return 0;
  client.println(F("SYST"));
  if(!eRcv()) return 0;
  client.println(F("Type I"));
  if(!eRcv()) return 0;
  client.println(F("PASV"));
  if(!eRcv()) return 0;
  char *tStr = strtok(outBuf,"(,");
  int array_pasv[6];
  for ( int i = 0; i < 6; i++) {
    tStr = strtok(NULL,"(,");
    array_pasv[i] = atoi(tStr);
    if(tStr == NULL)
      Serial.println(F("Bad PASV Answer"));    
    }

  unsigned int hiPort,loPort;
  hiPort = array_pasv[4] << 8;
  loPort = array_pasv[5] & 255;
  Serial.print(F("Data port: "));
  hiPort = hiPort | loPort;
  Serial.println(hiPort);
  if (dclient.connect(server,hiPort)) {
    Serial.println(F("Data connected"));
  } 
  else {
    Serial.println(F("Data connection failed"));
    client.stop();
    return 0;
  }
  // setup to send file file fileName
  client.print(F("STOR "));
  client.println(fileName);
  if(!eRcv())
  {
    dclient.stop();
    return 0;
  }
  // send file contents
  dclient.write(clientBuf,clientCount);
  dclient.stop();
  Serial.println(F("Data disconnected"));
  if(!eRcv()) return 0;
  client.println(F("QUIT"));
  if(!eRcv()) return 0;
  client.stop();
  Serial.println(F("Command disconnected"));
  return 1;
}

byte eRcv()
{
  byte respCode;
  byte thisByte;
  while(!client.available()) delay(1);
  respCode = client.peek();
  outCount = 0;
  while(client.available())
  {  
    thisByte = client.read();    
    Serial.write(thisByte);
    if(outCount < 127)
    {
      outBuf[outCount] = thisByte;
      outCount++;      
      outBuf[outCount] = 0;
    }
  }
  if(respCode >= '4')
  {
    efail();
    return 0;  
  }
  return 1;
}


void efail()
{
  byte thisByte = 0;
  client.println(F("QUIT"));
  while(!client.available()) delay(1);
  while(client.available())
  {  
    thisByte = client.read();    
    Serial.write(thisByte);
  }
  client.stop();
  Serial.println(F("Command disconnected"));
  Serial.println(F("SD closed"));
}

void printWifiStatus()
{
  // print the SSID of the network you're attached to
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength
  long rssi = WiFi.RSSI();
  Serial.print("Signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

a run gave

Attempting to connect to SSID: horacexxx
You're connected to the network
SSID: horacexxx
IP Address: 192.168.1.94
Signal strength (RSSI):-69 dBm
Ready. Press f
Command connected
220-FileZilla Server 0.9.60 beta
220-written by Tim Kosse (tim.kosse@filezilla-project.org)
220 Please visit https://filezilla-project.org/
331 Password required for horace
230 Logged on
215 UNIX emulated by FileZilla
200 Type set to I
227 Entering Passive Mode (192,168,1,96,225,155)
Data port: 57755
Data connected
150 Opening data channel for file upload to server of "/test.txt"
Data disconnected
226 Successfully transferred "/test.txt"
221 Goodbye
Command disconnected
FTP OK

horace:

/*

FTP passive client for IDE v1.0.1 and w5100/w5200
  Posted October 2012 by SurferTim
  Modified 6 June 2015 by SurferTim

adapted to run on a WeMos D1  ESP8266 device
 
*/

// WiFiexample to send a single line file

#include <SPI.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266mDNS.h>

//#define SPRINTF       // comment out to use strcat()

// update for your WiFi
const char* ssid = “horacexxxx”;
const char* password = “zzzzzzzz”;

// change to your server
IPAddress server( 192, 168, 1, 96 );

WiFiClient client;
WiFiClient dclient;
int status = WL_IDLE_STATUS;     // the Wifi radio’s status

char outBuf[128];
char outCount;

// fileName to your file (8.3 format!) and file
char fileName[13] = “test.txt”;
char clientBuf[64]=“hello from ESP-01 1234567890”;  // file to send
int clientCount = strlen(clientBuf);

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

while (!Serial) {
   ; // wait for serial port to connect. Needed for native USB port only
 }

// check for the presence of the shield:
 if (WiFi.status() == WL_NO_SHIELD) {
   Serial.println(“WiFi shield not present”);
   // don’t continue:
   while (true);
 }

// attempt to connect to Wifi network:
 while (status != WL_CONNECTED) {
   Serial.print("Attempting to connect to SSID: ");
   Serial.println(ssid);
   // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
   status = WiFi.begin(ssid, password);

// wait 10 seconds for connection:
   delay(10000);
 }

// you’re connected now, so print out the data
 Serial.println(“You’re connected to the network”);
 
 printWifiStatus();  delay(2000);
 Serial.println(F(“Ready. Press f”));
}

void loop()
{
 byte inChar;
 inChar = Serial.read();
 if(inChar == ‘f’)
 {
   if(doFTP()) Serial.println(F(“FTP OK”));
   else Serial.println(F(“FTP FAIL”));
 }
}

byte doFTP()
{
 if (client.connect(server,21)) {
   Serial.println(F(“Command connected”));
 }
 else {
    Serial.println(F(“Command connection failed”));
   return 0;
 }
 // send login name and password
 if(!eRcv()) return 0;
 client.println(F(“USER horace”));
 if(!eRcv()) return 0;
 client.println(F(“PASS horace”));
 if(!eRcv()) return 0;
 client.println(F(“SYST”));
 if(!eRcv()) return 0;
 client.println(F(“Type I”));
 if(!eRcv()) return 0;
 client.println(F(“PASV”));
 if(!eRcv()) return 0;
 char *tStr = strtok(outBuf,"(,");
 int array_pasv[6];
 for ( int i = 0; i < 6; i++) {
   tStr = strtok(NULL,"(,");
   array_pasv[i] = atoi(tStr);
   if(tStr == NULL)
     Serial.println(F(“Bad PASV Answer”));    
   }

unsigned int hiPort,loPort;
 hiPort = array_pasv[4] << 8;
 loPort = array_pasv[5] & 255;
 Serial.print(F("Data port: "));
 hiPort = hiPort | loPort;
 Serial.println(hiPort);
 if (dclient.connect(server,hiPort)) {
   Serial.println(F(“Data connected”));
 }
 else {
   Serial.println(F(“Data connection failed”));
   client.stop();
   return 0;
 }
 // setup to send file file fileName
 client.print(F("STOR "));
 client.println(fileName);
 if(!eRcv())
 {
   dclient.stop();
   return 0;
 }
 // send file contents
 dclient.write(clientBuf,clientCount);
 dclient.stop();
 Serial.println(F(“Data disconnected”));
 if(!eRcv()) return 0;
 client.println(F(“QUIT”));
 if(!eRcv()) return 0;
 client.stop();
 Serial.println(F(“Command disconnected”));
 return 1;
}

byte eRcv()
{
 byte respCode;
 byte thisByte;
 while(!client.available()) delay(1);
 respCode = client.peek();
 outCount = 0;
 while(client.available())
 {  
   thisByte = client.read();    
   Serial.write(thisByte);
   if(outCount < 127)
   {
     outBuf[outCount] = thisByte;
     outCount++;      
     outBuf[outCount] = 0;
   }
 }
 if(respCode >= ‘4’)
 {
   efail();
   return 0;  
 }
 return 1;
}

void efail()
{
 byte thisByte = 0;
 client.println(F(“QUIT”));
 while(!client.available()) delay(1);
 while(client.available())
 {  
   thisByte = client.read();    
   Serial.write(thisByte);
 }
 client.stop();
 Serial.println(F(“Command disconnected”));
 Serial.println(F(“SD closed”));
}

void printWifiStatus()
{
 // print the SSID of the network you’re attached to
 Serial.print("SSID: ");
 Serial.println(WiFi.SSID());

// print your WiFi shield’s IP address
 IPAddress ip = WiFi.localIP();
 Serial.print("IP Address: ");
 Serial.println(ip);

// print the received signal strength
 long rssi = WiFi.RSSI();
 Serial.print(“Signal strength (RSSI):”);
 Serial.print(rssi);
 Serial.println(" dBm");
}

There is some error from the code it said:

In file included from C:\Users\MyName\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39:0,

                 from C:\Users\MyName\Desktop\sketch_feb02a\sketch_feb02a.ino:14:

C:\Users\MyName\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h: In instantiation of 'size_t WiFiClient::write(T&, size_t) [with T = char [64]; size_t = unsigned int]':

C:\Users\MyName\Desktop\sketch_feb02a\sketch_feb02a.ino:141:38:   required from here

C:\Users\MyName\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h:123:36: error: request for member 'available' in 'source', which is of non-class type 'char [64]'

     size_t left = source.available();

                                    ^

C:\Users\MyName\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h:127:5: error: request for member 'read' in 'source', which is of non-class type 'char [64]'

     source.read(buffer.get(), will_send);

     ^

How I can fix this?

which library are you using? I used https://github.com/esp8266/Arduino

it compiles with 2.4

the include of WiFiClient.h and ESP8266mDNS.h are excess

Juraj: it compiles with 2.4

the include of WiFiClient.h and ESP8266mDNS.h are excess

horace: which library are you using? I used https://github.com/esp8266/Arduino

Oh yes, I'm not update the ESP8266, and it works now. But, where I can change the upload directory of File Manager from the code?