SPIFFS doesn't work anymore

miladgh
Posts: 10
Joined: Thu Oct 04, 2018 9:19 am

SPIFFS doesn't work anymore

Postby miladgh » Wed Nov 07, 2018 4:01 pm

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?

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: SPIFFS doesn't work anymore

Postby ESP_Sprite » Thu Nov 08, 2018 2:47 am

Moved to the Arduino subforum.

miladgh
Posts: 10
Joined: Thu Oct 04, 2018 9:19 am

Re: SPIFFS doesn't work anymore

Postby miladgh » Thu Nov 08, 2018 9:10 am

I checked the directory and found some files that I created before. I deleted them and it works again!

Who is online

Users browsing this forum: No registered users and 76 guests