Uploading a file to the SPIFF using POST

I have a config.json file uploaded to the SPIFF and I am accessing the name-value pairs with no problem.

I am now trying to see if I can overwrite that file using an Http Post.

I found sample code to upload a file to the ESP8266's SPIFF.

I am getting an error on the line:

HTTPUpload& upload = server.upload();

The error reads: 'class WiFiServer' has no member named 'upload'

I have seen forms that suggest I have the wrong library.

I have:

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>
#include "FS.h"
#include <ESP8266WebServer.h>

Looking in the Library Manager,I see a WiFI Built-in Libray by Arduino version 1.2.7.

Is this the culprit and should I be using a different library.

Any help would be appreciated.

Full sketch attached.

The sample I borrowed from is here: A Beginner's Guide to the ESP8266

I still need to add some of his code to the void loop() to handle the Post request, but I first want to get past this compile error.

Full Sketch.txt (13.9 KB)

It's the "ESP8266WebServer" class that has the 'upload()' method. See the 'SDWebServer' example in the IDE. You'll have to modify it for saving to SPIFFS rather than SD card.