In this guide, you’ll learn how to upload files to the ESP32 LittleFS Filesystem using Arduino IDE 2 (2.2.1 or a higher version). We’ll install an uploader plugin that will add a new menu to the Arduino IDE. This plugin is also compatible with the ESP8266 and Raspberry Pi Pico boards.
Using an ESP8266? Follow this tutorial instead: Arduino IDE 2: Install ESP8266 NodeMCU LittleFS Uploader (Upload Files to the Filesystem).
Table of Contents
- Introducing LittleFS
- Installing LittleFS Filesystem Uploader Plugin
- Uploading Files to ESP32 using the Filesystem Uploader
- Testing the ESP32 LittleFS Uploader
If you’re still using Arduino 1.8, you can follow this tutorial instead: ESP32: Upload Files to LittleFS using Arduino IDE (legacy).
Introducing LittleFS
LittleFS is a lightweight filesystem created for microcontrollers that lets you access the flash memory as you do in a standard file system on your computer, but it’s simpler and more limited. You can read, write, close, and delete files. Using LittleFS with the ESP32 boards is useful to:
- Create configuration files with settings;
- Save data permanently;
- Create files to save small amounts of data instead of using a microSD card;
- Save HTML, CSS, and JavaScript files to build a web server;
- Save images, figures, and icons;
- And much more.
Installing the LittleFS Uploader Plugin on Arduino IDE 2
To upload files to the ESP32 on Arduino IDE 2, we’ll use this LittleFS Uploader plugin that is compatible with Arduino 2.2.1 or higher and can be used with the ESP32, ESP8266, and Raspberry Pi Pico boards.
Windows Instructions
Follow the next steps to install the filesystem uploader if you’re using Windows (click here for MacOS instructions):
1) Go to the releases page and click the .vsix file to download.
![Download vsix file to install filesystem uploader plugin](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/05/arduino-littlefs-upload-vsix-file.png?resize=750%2C446&quality=100&strip=all&ssl=1)
2) On your computer, go to the following path: C:\Users\<username>\.arduinoIDE\. Create a new folder called plugins if you haven’t already.
![Create Plugins Folder Arduino IDE 2](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/02/create-plugins-folder-arduino-ide.png?resize=828%2C482&quality=100&strip=all&ssl=1)
3) Move the .vsix file you downloaded previously to the plugins folder (remove any other previous versions of the same plugin if that’s the case).
![Moving LittleFS uploader to the plugins folder arduino ide 2](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/05/arduino-ide-2-plugins.png?resize=777%2C271&quality=100&strip=all&ssl=1)
4) Restart or open the Arduino IDE 2. To check if the plugin was successfully installed, press [Ctrl] + [Shift] + [P] to open the command palette. An instruction called ‘Upload Little FS to Pico/ESP8266/ESP32‘ should be there (just scroll down or search for the name of the instruction).
![Upload LittleFS to Pico/ESP8266/ESP32](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/05/Upload-littlefs-esp32-esp8266-pico.png?resize=732%2C586&quality=100&strip=all&ssl=1)
That means the plugin was installed successfully. Proceed to this section to test the filesystem uploader plugin.
Mac OS X Instructions
Follow the next steps to install the filesystem uploader if you’re using Mac OS X:
1) Go to the releases page and click the .vsix file to download.
![LittleFS Uploader Plugin ESP32 ESP8266 Pico Upload Files to the Filesystem](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/05/arduino-littlefs-upload-vsix-file.png?resize=750%2C446&quality=100&strip=all&ssl=1)
2) In Finder, type ~/.arduinoIDE/ and open that directory.
![In Finder type ~/.arduinoIDE open that directory](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/02/Arduino-IDE-Directory-MACOS-f.png?resize=750%2C203&quality=100&strip=all&ssl=1)
3) Create a new folder called plugins.
![creating a plugins folder Arduino IDE 2 MacOS](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/02/Create-plugins-folder-arduino-ide-macos.png?resize=750%2C316&quality=100&strip=all&ssl=1)
4) Move the .vsix file to the plugins folder (remove any other previous versions of the same plugin if that’s the case).
![Moving vsix file Arduino IDE 2 in Mac OS - Uploader Plugin](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/05/moving-vsix-file-arduino-ide-2-mac-os.png?resize=750%2C309&quality=100&strip=all&ssl=1)
5) Restart or open the Arduino IDE 2. To check if the plugin was successfully installed, press [⌘] + [Shift] + [P] to open the command palette. An instruction called ‘Upload LittleFS to Pico/ESP8266/ESP32‘ should be there (just scroll down or search for the name of the instruction).
![Arduino IDE 2 Upload Filesystem Image ESP32](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/05/Arduino-IDE-Upload-Filesystem-Image-ESP32-MacOS.png?resize=750%2C254&quality=100&strip=all&ssl=1)
Uploading Files to ESP32 using the Filesystem Uploader in Arduino IDE 2
To upload files to the ESP32 LittleFS 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 2 Show Sketch Folder](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/02/arduino-ide-2-show-sketch-folder.png?resize=715%2C374&quality=100&strip=all&ssl=1)
3) Inside that folder, create a new folder called data.
![Creating a data folder inside the sketch folder](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/02/creating-data-folder.png?resize=250%2C129&quality=100&strip=all&ssl=1)
4) Inside the data folder is where you should put the files you want to upload to the ESP32 filesystem. As an example, create a .txt file with some text called test_example.txt (and save it inside the data folder).
![Testing the ESP32 filesystem txt file](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/05/test_file_esp32_filesystem.png?resize=515%2C265&quality=100&strip=all&ssl=1)
5) Make sure you have the right board (Tools > Board) and COM port selected (Tools > Port).
6) Depending on the ESP32 board selected, you may need to select the desired flash size (some boards don’t have that option, don’t worry). In the Arduino IDE, in Tools > Flash size, select the desired flash size (this will depend on the size of your files).
7) Then, upload the files to the ESP32 board. Press [Ctrl] + [Shift] + [P] on Windows or [⌘] + [Shift] + [P] on MacOS to open the command palette. Search for the Upload LittleFS to Pico/ESP8266/ESP32 command and click on it.
Important: ensure the Serial Monitor is closed. Otherwise, the upload will fail.
After a few seconds, you should get the message “Completed upload. “. The files were successfully uploaded to the ESP32 filesystem.
![Arduino IDE 2: files uploaded successfully to the ESP32 filesystem](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/05/littlefs-upload-completed-esp32-arduino-ide-2.png?resize=666%2C586&quality=100&strip=all&ssl=1)
Troubleshooting
If you get the following error message “ERROR: No port specified, check IDE menus“, restart the Arduino IDE, and try again.
Testing the ESP32 LittleFS Uploader
Now, let’s check if the file was saved into the ESP32 filesystem. Upload the following code to your ESP32 board. This code will read the contents of the .txt file you saved previously on LittleFS.
#include "LittleFS.h"
void setup() {
Serial.begin(115200);
if(!LittleFS.begin()){
Serial.println("An Error has occurred while mounting LittleFS");
return;
}
File file = LittleFS.open("/test_example.txt", "r");
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() {
}
After uploading, open the Serial Monitor at a baud rate of 115200.
Press the ESP32 on-board “RST” button. It should print the content of your .txt file in the Serial Monitor.
![Testing the ESP8266 Filesystem Uploader Plugin Arduino IDE 2](https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2024/05/testing-esp32-filesystem-arduino-ide-2.png?resize=666%2C687&quality=100&strip=all&ssl=1)
You’ve successfully uploaded files to the ESP32 filesystem using the plugin.
Wrapping Up
In this tutorial, we’ve shown you how to upload files to the ESP32 LittleFS filesystem on Arduino IDE 2 using an uploader plugin.
We’ve shown you how to upload a .txt file, but you can upload other file formats like HTML, CSS, and Javascript files to build a web server, images, or small icons, save configuration files, etc.
To learn more about the ESP32, check our resources:
- Learn ESP32 with Arduino IDE (eBook)
- SMART HOME with Raspberry Pi, ESP32, ESP8266
- Build Web Servers with ESP32 and ESP8266
- Firebase Web App with ESP32 and ESP8266
- More ESP32 Tutorials and Guides
Thanks for reading.
Thank you so much for this!
As someone who used LittelFS for a couple of projects I did way-back, I found it so frustrating to read messages online that said how difficult it would be to support LittleFS in IDE2, if – indeed – it would be possible at all.
I will read your article with interest and make rude cyber-gestures at the nay-sayers!
Support for the ESP32 was added very recently to the Arduino IDE 2.
Regards,
Sara
Howdy Again
As usual a great tutorial which worked floorlessly and has answered alot of questions that I had about sketches that needed the data uploaded to the board.
It took me a long time to dicover that older older arduino Ide supported this function and now you have explained wonderfully how to upload LittleFs in latest Arduino IDE.
I thankyou and the team and look forward to your tutorials and the information from your site.
Thanks from the UK
Mark D
Wow, finally the LittleFS is available on Arduino IDE 2.0! Excelent post, by the way, the quality of the tutorials remains the same when I found this site, 5 yars ago: excelent!
Thank you 😀
Regards,
Sara
Is there any plugins that support SPIFFS? Thanks.
For spiffs, you have to use the old Arduino IDE.
https://randomnerdtutorials.com/install-esp32-filesystem-uploader-arduino-ide/
Regards,
Sara
See here: https://github.com/espx-cz/arduino-spiffs-upload
cool.
Use this for Arduino IDE V2: https://github.com/espx-cz/arduino-spiffs-upload
Hi Sara and Rui,
I was very happy to see your new tutorial about upload LittleFS now is implemented in the Arduino IDE 2.
I’m working on MAC and stuck on one problem. My upload to LitteFS ends with this error:
A fatal error occurred: Could not open /dev/cu.usbserial-1420, the port doesn’t exist
ERROR: Upload failed, error code: 2
Maybe it has to do with an open Serial-monitor connection. In the old IDE 1, you had to close this connection before starting upload of data and this was done very simple by just closing the (distinct) window were Serial-monitor was dumping it’s data.
In the IDE 2 it’s not very clear how to close Serial-monitor. As Serial monitor is in the bottom panel of my sketch-window.
Here the complete log output of my uploading to LittleFS:
Using partition: default
Building LittleFS filesystem
/Users/jop/Library/Arduino15/packages/esp32/tools/mklittlefs/3.0.0-gnu12-dc7f933/mklittlefs -c /Users/jop/STACK/ArduinoSketches/@KENNIS/LittleFS/TestLittleFS/data -p 256 -b 4096 -s 1441792 /var/folders/vd/rhwhbr1s5j77gkn7yq_qfmlm0000gn/T/tmp-7661-q2cK0GA8qGrt-.littlefs.bin
/test_example.txt
Uploading LittleFS filesystem
/Users/jop/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool –chip esp32 –port /dev/cu.usbserial-1420 –baud 921600 –before default_reset –after hard_reset write_flash -z –flash_mode dio –flash_freq 80m –flash_size detect 2686976 /var/folders/vd/rhwhbr1s5j77gkn7yq_qfmlm0000gn/T/tmp-7661-q2cK0GA8qGrt-.littlefs.bin
esptool.py v4.5.1
Serial port /dev/cu.usbserial-1420
A fatal error occurred: Could not open /dev/cu.usbserial-1420, the port doesn’t exist
ERROR: Upload failed, error code: 2
The port cu.usbserial-1420 does exist, as I used it to upload my test sketch.
My macOS is Sonoma.
With kind regards,
Jop
Close Serial terminal first, then try it again.
Here is a SPIFFS clone: https://github.com/espx-cz/arduino-spiffs-upload
Great!
Thanks for sharing.
Regards,
Sara
FYI, I got this to work in the sample with a XIAO ESP32C3.
Thanks
I have Arduino 2.3.2 on Windows. I followed the instructions and reopened the IDE, did the Fn+CTRL+P and the file uploader is not on the list!
First I put the latest release (arduino-littlefs-upload-1.1.7.vsix) in the plugins folder, with the following path: C:\Users\kevin.arduinoIDE\plugins. When it didn’t work, I deleted that file and replaced it with the version mentioned in the tutorial
(arduino-littlefs-upload-1.1.5.vsix) but it still did not work. The board I selected is ESP32 Dev Module. Any ideas?
i have the same problem like you. Sometimes i get the message “Upload LittleFS to Pico/ESP8266/esp32” on the list, but only once. When i try a second time, the message is no more there.
Hello.
Here is a list created by the community containing plugins compatible with the Arduino IDE 2.x: github.com/MicSG-dev/list-of-compatible-plugins-with-arduino-ide-2-x
Link: github.com/MicSG-dev/list-of-compatible-plugins-with-arduino-ide-2-x/
Only site that gives actual solution.
Hello,
Thanks for the useful tutorials you keep sharing 🙂
I used the tool. Upload went well but it erased (overwote ?) the NVS preferences on the board.
Do you know how to upload /data to littleFS and keep “preferences” untouched ?
Thanks
Hi.
Thanks for your feedback.
I didn’t know about that.
I searched for a while and found people with the same issue, but no answers… I don’t know how to fix that issue.
If you find a solution, please share.
Regards,
Sara
I tried on another board (Mini D1 ESP32) and this time upload did not erase preferences. Same Arduino IDE and tool version.
I could not find a systematic way to reproduce the problem ! It is strange.
Аctivating extension ‘arduino-littlefs-upload’ failed: Cannot find module ‘c:\Users.…..arduinoIDE\plugins\arduino-littlefs-upload-1.1.8\out\extension.js’ Require stack: – C:\Users.……\AppData\Local\Programs\arduino-ide\resources\app\lib\backend\plugin-host.js
If anyone has this problem, you need to change the file extension extension.ts from the src folder to js and move the file to the created “out” folder
ARDUINO IDE 2.3.2
esptool 4.5.1
ESP32 S3 WROOM
For Gyver project WIFI panel matrix on WS2812b 1024 LEDS
The previous steps were executed according to your steps, but an error message appeared :
ERROR: Partition entry not found in csv file!
How to fix it?
Hi.
When do you get that error?
What board are you selecting in Tools > Board?
Regards,
Sara
Try replacing partitions.csv with this one: github.com/espressif/arduino-esp32/blob/master/tools/partitions/default.csv
As always, this place is my first rescue whenever I run into an Arduino related problem and once again I found a crystal clear tutorial that works. Thank you so much!
I have a question about Step #7. Before asking, I would like to say this website has helped me a lot when building my projects. Thanks in advance for your help.
QUESTION:
What would happen if we DON’t perform step #7:
“Then, upload the files to the ESP32 board. Press [Ctrl] + [Shift] + [P] on Windows or [⌘] + [Shift] + [P] on MacOS to open the command palette. Search for the Upload LittleFS to Pico/ESP8266/ESP32 command and click on it.”
…and just programatically write:
File file = LittleFS.open(“example_data.json”, “w”);
then we serialize some JSON data to the file “example_data.json”
and finally we close the file using “file.close();”
Wouldnt that technically CREATE the file if it doesnt exist?
Or its mandatory to ALWAYS perform manually step#7 in ArduinoIDE 2.0?
I mean, I know we need to create a “data” folder at the root of our sketch, but do we also NEED to manually create the file we want to manipulate and ALSO perform step #7?
Can step #7 be performed programatically inside the sketch?
Thank you!!