Whiddled it down to the following code.
Any help is appreciated.
Don't exactly get whats going on.
Code: Select all#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include "spiffs/spiffs.h"
#include <FS.h>
const char* ssid = "........";
const char* password = "........";
ESP8266WebServer server(80);
const char* serverIndex = "<form method='POST' action='/update' enctype='multipart/form-data'><input type='file' name='update'><input type='submit' value='Update'></form>";
void setup(void)
{
SPIFFS.begin();
Serial.begin(9600);
WiFi.mode(WIFI_AP_STA);
WiFi.begin(ssid, password);
if (WiFi.waitForConnectResult() == WL_CONNECTED)
{
server.on("/", HTTP_GET, []() {
server.sendHeader("Connection", "close");
server.sendHeader("Access-Control-Allow-Origin", "*");
server.send(200, "text/html", serverIndex);
});
server.onFileUpload([]() {
//if (server.uri() != "/update") return;
HTTPUpload& upload = server.upload();
String Test = upload.filename.c_str();
File f = SPIFFS.open(String("/" + Test ), "w");
f.print(upload.buf);
f.close();
yield();
});
server.on("/update", HTTP_POST, []() {
server.sendHeader("Connection", "close");
server.sendHeader("Access-Control-Allow-Origin", "*");
server.send(200, "text/plain", "OK");
ESP.restart();
});
server.begin();
}
}
void loop(void) {
server.handleClient();
delay(0);
}
I get the following error msg.
Code: Select allIn file included from dfgdfgdfgdfg.ino:11:0:
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/FS.h:112:11: error: 'FS' is already declared in this scope
using fs::FS;
^
dfgdfgdfgdfg.ino: In lambda function:
dfgdfgdfgdfg:37: error: call of overloaded 'print(uint8_t [2048])' is ambiguous
dfgdfgdfgdfg.ino:37:25: note: candidates are:
In file included from C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Stream.h:26:0,
from C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/HardwareSerial.h:32,
from C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Arduino.h:247,
from C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\libraries\ESP8266WiFi\src/WiFiClient.h:24,
from C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\libraries\ESP8266WiFi\src/ESP8266WiFi.h:32,
from dfgdfgdfgdfg.ino:5:
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:68:16: note: size_t Print::print(const String&) <near match>
size_t print(const String &);
^
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:68:16: note: no known conversion for argument 1 from 'uint8_t [2048] {aka unsigned char [2048]}' to 'const String&'
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:69:16: note: size_t Print::print(const char*) <near match>
size_t print(const char[]);
^
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:69:16: note: no known conversion for argument 1 from 'uint8_t [2048] {aka unsigned char [2048]}' to 'const char*'
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:70:16: note: size_t Print::print(char) <near match>
size_t print(char);
^
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:70:16: note: no known conversion for argument 1 from 'uint8_t [2048] {aka unsigned char [2048]}' to 'char'
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:71:16: note: size_t Print::print(unsigned char, int) <near match>
size_t print(unsigned char, int = DEC);
^
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:71:16: note: no known conversion for argument 1 from 'uint8_t [2048] {aka unsigned char [2048]}' to 'unsigned char'
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:72:16: note: size_t Print::print(int, int) <near match>
size_t print(int, int = DEC);
^
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:72:16: note: no known conversion for argument 1 from 'uint8_t [2048] {aka unsigned char [2048]}' to 'int'
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:73:16: note: size_t Print::print(unsigned int, int) <near match>
size_t print(unsigned int, int = DEC);
^
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:73:16: note: no known conversion for argument 1 from 'uint8_t [2048] {aka unsigned char [2048]}' to 'unsigned int'
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:74:16: note: size_t Print::print(long int, int) <near match>
size_t print(long, int = DEC);
^
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:74:16: note: no known conversion for argument 1 from 'uint8_t [2048] {aka unsigned char [2048]}' to 'long int'
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:75:16: note: size_t Print::print(long unsigned int, int) <near match>
size_t print(unsigned long, int = DEC);
^
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Print.h:75:16: note: no known conversion for argument 1 from 'uint8_t [2048] {aka unsigned char [2048]}' to 'long unsigned int'
call of overloaded 'print(uint8_t [2048])' is ambiguous