Install ESP32 Filesystem Uploader in Arduino IDE

The ESP32 contains a Serial Peripheral Interface Flash File System (SPIFFS). SPIFFS is a lightweight filesystem created for microcontrollers with a flash chip, which are connected by SPI bus, like the ESP32 flash memory. In this article we’re going to show how to easily upload files to the ESP32 filesystem using a plugin for Arduino IDE.

Install ESP32 Filesystem Uploader in Arduino IDE

Note: if you have an ESP8266 board, read Install ESP8266 Filesystem Uploader in Arduino IDE.

Introducing SPIFFS

SPIFFS lets you access the flash memory like you would do in a normal filesystem in your computer, but simpler and more limited. You can read, write, close, and delete files. At the time of writing this post, SPIFFS doesn’t support directories, so everything is saved on a flat structure.

Using SPIFFS with the ESP32 board is specially useful to:

In most of our web server projects, we’ve written the HTML code for the web server as a String directly on the Arduino sketch. With SPIFFS, you can write the HTML and CSS in a separated file and save them on the ESP32 filesystem. Check the following tutorial to learn how to build a web server with files stored on the ESP32 file system:

Installing the Arduino ESP32 Filesystem Uploader

You can create, save and write files to the ESP32 filesystem by writing the code yourself on the Arduino IDE. This is not very useful, because you’d have to type the content of your files in the Arduino sketch.

Fortunately, there is a plugin for the Arduino IDE that allows you to upload files directly to the ESP32 filesystem from a folder in your computer. This makes it really easy and simple to work with files. Let’s install it.

First, make sure you have the latest Arduino IDE installed, and you have the ESP32 add-on for the Arduino IDE. If you don’t, follow one of the following tutorials to install the add-on:

Follow the next steps to install the filesystem uploader:

1) Go to the releases page and click the ESP32FS-1.0.zip file to download.

Download ESP32 SPIFFS Filesystem fs for Arduino IDE

2) Go to the Arduino IDE directory, and open the Tools folder.

Arduino IDE Tools to Install ESP32 SPIFFS Filesystem fs

3) Unzip the downloaded .zip folder to the Tools folder. You should have a similar folder structure:

<home_dir>/Arduino-<version>/tools/ESP32FS/tool/esp32fs.jar
Arduino IDE Tools to Install ESP32 SPIFFS Filesystem fs

4) Finally, restart your Arduino IDE.

To check if the plugin was successfully installed, open your Arduino IDE. Select your ESP32 board, go to Tools and check that you have the option “ESP32 Sketch Data Upload“.

ESP32 Sketch Data Upload Arduino IDE SPIFFS FS Filesystem

Uploading Files using the Filesystem Uploader

To upload files to the ESP32 filesystem follow the next instructions.

1) Create an Arduino sketch and save it. For demonstration purposes, you can save an empty sketch.

2) Then, open the sketch folder. You can go to Sketch > Show Sketch Folder. The folder where your sketch is saved should open.

Arduino IDE Show Sketch folder to create data folder

3) Inside that folder, create a new folder called data.

ESP32 Arduino Sketch Example File Filesystem fs SPIFFS

4) Inside the data folder is where you should put the files you want to be saved into the ESP32 filesystem. As an example, create a .txt file with some text called test_example.

ESP32 Notepad Test Example File Filesystem fs SPIFFS

5) Then, to upload the files, in the Arduino IDE, you just need to go to Tools > ESP32 Sketch Data Upload.

ESP32 Sketch Data Upload Arduino IDE SPIFFS FS Filesystem

Note: in some ESP32 development boards you need to keep the ESP32 on-board “BOOT” button pressed while it’s uploading the files. When you see the “Connecting …….____……” message, you need to press the ESP32 on-board “BOOT” button.

SPIFFS Image Connecting to ESP32 board

When you see the message “SPIFFS Image Uploaded“, the files were successfully uploaded to the ESP32 filesystem.

SPIFFS Image Uploaded to ESP32 board

Testing the Uploader

Now, let’s just check if the file was actually saved into the ESP32 filesystem. Simply upload the following code to your ESP32 board.

/*********
  Rui Santos
  Complete project details at https://randomnerdtutorials.com  
*********/

#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_example.txt");
  if(!file){
    Serial.println("Failed to open file for reading");
    return;
  }
  
  Serial.println("File Content:");
  while(file.available()){
    Serial.write(file.read());
  }
  file.close();
}
 
void loop() {

}

View raw code

After uploading, open the Serial Monitor at a baud rate of 115200. Press the ESP32 “ENABLE” button. It should print the content of your .txt file on the Serial Monitor.

ESP32 SPIFFS FS Filesystem Example Arduino IDE Serial Monitor

You’ve successfully uploaded files to the ESP32 filesystem using the plugin.

Wrapping Up

Using the filesystem uploader plugin is one of the easiest ways to upload files to the ESP32 filesystem. Check the following project to see how to build a web server using HTML and CSS files stored on the filesystem: ESP32 Web Server using SPIFFS (SPI Flash File System).

For more projects with ESP32, check the following tutorials:

This is an excerpt from our course: Learn ESP32 with Arduino IDE. If you like ESP32 and you want to learn more, we recommend enrolling in Learn ESP32 with Arduino IDE course.


Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »

Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »


Enjoyed this project? Stay updated by subscribing our weekly newsletter!

18 thoughts on “Install ESP32 Filesystem Uploader in Arduino IDE”

  1. You stated that “After uploading, open the Serial Monitor at a baud rate of 115200. Press the ESP32 “ENABLE” button.”

    Just where is this ESP32 “ENABLE” button located?

    My sketch does not show any of the test data from the text file. It does print out “File Content:”. But nothing elese.

    And even when I deliberately rename the file in the sketch to something else, it does not tell me that “Failed to open file for reading” but still displays “File Content:” with nothing else.

    I am using Arduino 1.8.5 on Windows 10

    Reply
  2. Boa tarde!

    Será possível através dos SPIFFS controlar os GPIO do ESP32? Ou seja, eu quero gravar um ficheiro de configuração (formato json) onde indico que pinos desejo ler os dados de sensores do meu ESP32, quando ele arrancar vai ler esse ficheiro.

    Cumprimentos,

    Francisco Pinheiro

    Reply
  3. So far I haven’t been successful uploading additional files.

    SPIFFS.open(“[FilePath]”) always returns true whether or not the file was uploaded.
    SPIFFS.exists(“[FilePath]”) return false whether or not the file was included in the /data directory.

    Specs
    Mac OS 10.14.5
    Arduino IDE 1.8.9
    On an ESP32
    Using Arduino IDE > Tools > Board > ESP32 Dev Module

    Reply
    • Hi Carl.
      I’ve never faced that issue.
      Unfortunately, without further information, it is very difficult to understand what might be wrong.
      If anyone knows a solution for this, please help.
      Regards,
      Sara

      Reply
  4. Hi: I’m trying to install ESP32 filesystem uploader into the Arduino IDE 1.8.5. I have the esp32fs.jar in this path: Macintosh HD⁩ ▸ ⁨Users⁩ ▸ ⁨richardromig⁩ ▸ ⁨Dropbox⁩ ▸ ⁨Arduino IDE 1.8.5⁩ ▸ ⁨Tools⁩ ▸ ⁨ESP32FS⁩ ▸ ⁨tool⁩ but the option “ESP32 Sketch Data Upload“ does not appear in the IDE. I am running MacOS 10.14.6 Any suggestions?

    Reply
    • yes, I copied-pasted the file esp32fs.jar in creating some folders like this : Macintosh HD⁩ ▸ ⁨Utilisateurs⁩ ▸ ⁨MyName ▸ ⁨Documents⁩ ▸ ⁨Arduino⁩ ▸ ⁨tools⁩ ▸ ⁨ESP32FS⁩ ▸ ⁨tool⁩ ▸ esp32fs.jar and the option “ESP32 Sketch Data Upload“ appear in the IDE.

      macOS Mojave 10.14.6

      Reply
  5. Very important for linux users! I create in data folder text file. Then I do same, but I dont see file content (nothing wrong, just dont see characters). Then I try to rename file to like this “test_example.txt”. And it works! In linux, mostly txt file is not txt file.

    Reply
  6. Hi.
    Richard , I had the same problem. But creating a Tools folder under the Sketch folder and placing the ESP32FS⁩ there did the trick.-Not the first time something like this comes up.

    Reply
  7. I had a problem when I installed the ESP32 filesystem uploader in a new tools folder where all my arduino archives are kept. It didn’t install properly.
    However, it worked when I installed the uploader to Local Disk(c:), Program Files(x86), Arduino, tools folder.
    Excellent.
    Just make sure a data folder is in the same folder as your arduino code.

    Reply

Leave a Comment

Download our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.