Your Files,
Anywhere. Anytime.

Transform your ESP32 into a powerful file server with secure web and FTP access. Complete with user authentication, file uploads, downloads, and management capabilities.

Your Personal ESP32 Server

Fast, secure, and versatile file management for IoT projects.

Stop struggling with moving files to your ESP32 projects.
This server brings modern web and FTP access to your microcontroller,
making file management as simple as using a cloud service.

With built-in user authentication, responsive design, and intuitive interface,
managing your device's file system has never been easier.

Powerful Features

Secure Authentication

Multi-user support with admin and regular user roles. Session management with automatic timeouts.

Dual Access Methods

Modern web interface plus traditional FTP access. Choose what works best for your workflow.

Flexible Connectivity

Connect to your WiFi network or use Access Point mode when no network is available.

File Management

Upload, download, create directories and delete files with an intuitive interface and progress tracking.

User Management

Admin panel for creating, editing, and deleting users. Control access to your files with fine-grained permissions.

Responsive Design

Access your files from any device - desktop, tablet, or smartphone with a beautiful, adaptive interface.

ESP32 + Web Server + FTP + SD Card =
Your Complete File Management Solution

Get Started — In Minutes

Download the code, flash your ESP32, and start managing your files with ease.

Installation Instructions

What You'll Need:

  • ESP32 development board
  • Micro SD card
  • Micro USB cable
  • Arduino IDE installed
  • ESP32 board definition in Arduino IDE
  • Required libraries:
    • WiFi
    • WebServer
    • SimpleFTPServer
    • ESPmDNS
    • SPI
    • SD
    • FS
    • ArduinoJson

Quick Setup:

  1. Clone the GitHub repository
  2. Open the project in Arduino IDE
  3. Connect SD card to ESP32 (default pins: CS=5, MOSI=23, MISO=19, SCK=18)
  4. Update WiFi credentials in the code
  5. Upload the code to your ESP32
  6. Open Serial Monitor at 115200 baud to see the IP address
  7. Access the web interface at http://[IP_ADDRESS]
  8. Default login: admin / admin123

Hardware Setup

SD Card Connection

Connect your SD card module to ESP32 using these default pins:

SD Card Pin ESP32 Pin
CS (Chip Select) GPIO 5
MOSI (Master Out Slave In) GPIO 23
MISO (Master In Slave Out) GPIO 19
SCK (Serial Clock) GPIO 18
VCC 3.3V
GND GND

Note: You can modify these pin assignments in the code if needed for your specific hardware setup.

// SD card configuration
#define SD_CS 5    // SD card chip select pin
#define SPI_MOSI 23
#define SPI_MISO 19
#define SPI_SCK 18

// Initialize SD card
SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI, SD_CS);
SD.begin(SD_CS);

Network Configuration

WiFi Client Mode

When starting up, the ESP32 will try to connect to your WiFi network using the credentials in the code. If the connection is successful, you can access the server via the IP address shown in the Serial Monitor.

// WiFi credentials
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";

Access Point (AP) Mode

If WiFi connection fails, the ESP32 will automatically switch to Access Point mode, creating its own WiFi network that you can connect to directly.

// Access Point settings (used if WiFi connection fails)
const char* ap_ssid = "ESP32-FileServer";
const char* ap_password = "fileserver123";

Web Interface Preview

Login Screen

ESP32 File Server - Login
ESP32 File Server
Please log in to continue

Secure login with session management

File Manager

ESP32 File Server - File Manager
ESP32 File Server
Logout
Upload File
New Folder
Root / Documents /
Name
Size
Actions
📁
Projects
-
🗑️
📄
data.txt
2.4 KB
⬇️ 🗑️
🖼️
image.jpg
145 KB
⬇️ 🗑️

Intuitive file management interface

A Glimpse of the Code

// Function to connect to WiFi with multiple attempts
bool connectToWiFi() {
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  
  Serial.print("Connecting to WiFi...");
  
  // Wait for connection with extended timeout and multiple attempts
  int attempts = 0;
  const int maxAttempts = 3;
  
  while (attempts < maxAttempts) {
    unsigned long startTime = millis();
    
    // Try for 30 seconds per attempt
    while (WiFi.status() != WL_CONNECTED && millis() - startTime < 30000) {
      delay(500);
      Serial.print(".");
    }
    
    if (WiFi.status() == WL_CONNECTED) {
      Serial.println("\nConnected to WiFi!");
      Serial.print("IP Address: ");
      Serial.println(WiFi.localIP());
      server_ip = WiFi.localIP().toString();
      wifiConnected = true;
      accessPointMode = false;
      
      // Start mDNS responder
      if (MDNS.begin("esp32files")) {
        Serial.println("mDNS responder started - You can access the server at http://esp32files.local");
        MDNS.addService("http", "tcp", webServerPort);
      } else {
        Serial.println("Error starting mDNS responder!");
      }
      
      return true;
    } else {
      attempts++;
      Serial.println("\nWiFi connection attempt " + String(attempts) + " failed.");
      
      if (attempts < maxAttempts) {
        Serial.println("Retrying...");
        WiFi.disconnect();
        delay(1000);
        WiFi.begin(ssid, password);
        Serial.print("Connecting to WiFi...");
      }
    }
  }
  
  Serial.println("\nWiFi connection failed after " + String(maxAttempts) + " attempts. Starting Access Point...");
  setupAccessPoint();
  return false;
}

// Function to set up an Access Point if WiFi connection fails
void setupAccessPoint() {
  WiFi.disconnect();
  delay(1000);
  WiFi.mode(WIFI_AP);
  WiFi.softAP(ap_ssid, ap_password);
  server_ip = WiFi.softAPIP().toString();
  Serial.print("Access Point Started. IP Address: ");
  Serial.println(server_ip);
  wifiConnected = false; // Not connected to external WiFi
  accessPointMode = true; // In AP mode
}

Key Implementation Features

Session Management

Secure token-based authentication with configurable session timeouts. Automatically expires inactive sessions for better security.

Fallback Access Point

Intelligent network handling that switches to AP mode when WiFi connection fails, ensuring you always have access to your files.

User Permission Levels

Built-in user roles with regular users and administrators.

File System Operations

Complete set of file management functions including recursive directory creation and deletion, safe file transfers, and more.

Why Use ESP32 File Server?

The ESP32 File Server is a simple tool that allows you to store and retrieve files from an SD card via a web interface.
No flashing, no auto-updates just basic file management..

Perfect Use Cases

  • Sensor Data Storage - Store and retrieve logs from connected sensors
  • Configuration Files - Upload and manage files like .json or .txt for your IoT projects
  • Local Network Access - Easily access files stored on the ESP32 over LAN
  • Static Asset Hosting - Manage images, documents, or other static files on the SD card

Simple. Reliable. Just a file server. Perfect for lightweight file management on your ESP32 projects.

Support This Project

This project is open-source and free to use. If you find it useful for your projects, please consider supporting its continued development.

Buy Me a Coffee

(A tiny thanks powers the next evolution.)