Page 1 of 1

SPIFFS doesn't work anymore

Posted: Wed Nov 07, 2018 4:01 pm
by miladgh
Hey guys,
I'm working with an ESP32 and need to write some files there.
but the problem is, SPIFFS doesn't work anymore.

I used SPIFFS_Test from Examples or this code:

Code: Select all

#include "SPIFFS.h"
 
void setup() {
 
  Serial.begin(115200);
 
  if (!SPIFFS.begin(true)) {
    Serial.println("An Error has occurred while mounting SPIFFS");
    return;
  }
 
  File file = SPIFFS.open("/test.txt", FILE_WRITE);
 
  if (!file) {
    Serial.println("There was an error opening the file for writing");
    return;
  }
 
  if (file.print("TEST")) {
    Serial.println("File was written");
  } else {
    Serial.println("File write failed");
  }
 
  file.close();
 
  Serial.println(SPIFFS.exists("/test.txt"));
  Serial.println(SPIFFS.exists("/nonexisting.txt"));
 
}
 
void loop() {}
But I got just "FAILED ERROR."
What could be the reason?

Re: SPIFFS doesn't work anymore

Posted: Thu Nov 08, 2018 2:47 am
by ESP_Sprite
Moved to the Arduino subforum.

Re: SPIFFS doesn't work anymore

Posted: Thu Nov 08, 2018 9:10 am
by miladgh
I checked the directory and found some files that I created before. I deleted them and it works again!