Chat freely about anything...

User avatar
By Tertius21
#75513 I use the basic ota example.
I can upload the sketch without problems. i must enter the password and it works.
But if i want to upload "esp8266 Sketch Data Upload" (in the arduino ide Tools Menu) then i get these Error:
Code: Select allAuthenticating...FAIL

14:24:44 [ERROR]: Authentication Failed

SPIFFS Upload failed!


What is wrong and how can i fix this?
User avatar
By PatrykW
#75541 Can't help you with Arduino IDE since I'm not using it, but I can give you a workaround:
Code: Select allvoid downloadFile(String url, String destination){
   HTTPClient http;
   http.begin(url);
   int httpCode = http.GET();
   if(httpCode > 0) {
      File ff = SPIFFS.open(destination, "w");
      int len = http.getSize();
      uint8_t buff[128] = { 0 };
      WiFiClient * stream = http.getStreamPtr();
      while(http.connected() && (len > 0 || len == -1)) {
         size_t size = stream->available();
         if(size) {
            int c = stream->readBytes(buff, ((size > sizeof(buff)) ? sizeof(buff) : size));
            ff.write(buff, c);
         }
      }
      ff.close();
   }
}

Now. You set up a basic web server on your computer, put the files on it and you can download them to SPIFFS using a piece of code like the one above. Usually makes more sense than flashing entire image anyways. It's faster too.
User avatar
By Quercus62
#86431 The sketch Data Upload tool does work over OTA, but only when no password is set. See topic https://github.com/esp8266/arduino-esp8266fs-plugin/releases/tag/0.2.0.

So it is possible to upload data. You can first upload the sketch with no OTA-password set. Upload the data. Then upload the sketch with OTA-password.

Another option is to use esp8266FTPServer in your sketch. See https://github.com/nailbuster/esp8266FTPServer