In the world of IoT development, ESP32 and ESP8266 microcontrollers are popular choices due to their low cost, ease of use, and versatility. However, one of the challenges developers face is managing files like HTML, CSS, images, and configuration files on these devices. That’s where SPIFFS (SPI Flash File System) comes into play. SPIFFS is a lightweight file system specifically designed for microcontrollers with constrained storage, allowing you to store and access files directly in the device’s flash memory.
With SPIFFS, you can easily manage web content, logs, or configuration data directly from the flash storage, without needing additional memory. This feature is particularly useful when building web servers on ESP32 or ESP8266, where you might need to serve static files, load sensor data, or retain device configuration files across reboots.
This guide will walk you through setting up the SPIFFS filesystem uploader for both ESP32 and ESP8266 in the Arduino IDE, enabling you to manage files more effectively and enhance your projects with a robust file storage solution.
Method to add filesystem uploader
If you open a file in your Arduino IDE and click on Tools you won’t get the two options ESP32 Sketch Data Upload & ESP8266 Sketch Data Upload due to missing required plugins.

They allow us to load our files into SPIFFS or flash memory of esp32/esp8266 we can use in our code easily.
Download the below zip file and extract it into your Arduino IDE sketch directory.
If you are unable to find the sketch directory, click on File-> Preferences and here you can find where your Arduino sketches are being saved. Here you need to extract the above zip file.

Below is the snippet showing how these plugin files should be saved in the Arduino sketch directory.

Now just restart your Arduino IDE and click on tools option again. Now you will be able to see the required options.

Conclusion
Using SPIFFS on ESP32 or ESP8266, you can easily serve HTML files and create custom web interfaces. You can store any kind of files in flash memory. The only limitation is its size which is 4MB. This approach is ideal for creating configuration pages or displaying sensor data in IoT projects and data logging with no need of using SD Card.
Thank You!!!