Skip to Content
CardsFile Upload (New)

File Upload Card

This feature is only available in ESP-DASH Pro
Preview

The File Upload Card allows users to upload files from their browser to the device. Useful for configuration, firmware, or data uploads.

Initializer

To create a file upload card, use the dash::FileUploadCard class:

dash::FileUploadCard fileUpload(dashboard, "Upload", ".txt");
  • The third argument is the accepted file extension(s) (optional).

Methods

setValue(const char* url)

Set the upload URL where the file will be sent.

fileUpload.setValue("/upload-endpoint");
  • Signature: void setValue(const char* url)
  • Parameters:
    • const char* url — The URL to which the file will be uploaded.
  • Returns: void

value()

Get the current upload URL.

const char* url = fileUpload.value();
  • Signature: const char* value()
  • Parameters: None
  • Returns: const char* — The current upload URL.

setExtensions(const char* extensions)

Set the accepted file extensions for the upload dialog (e.g., “.txt,.jpg”).

fileUpload.setExtensions(".txt,.jpg");
  • Signature: void setExtensions(const char* extensions)
  • Parameters:
    • const char* extensions — Comma-separated list of accepted file extensions or MIME types.
  • Returns: void

extensions()

Get the current accepted file extensions or MIME types.

const char* ext = fileUpload.extensions();
  • Signature: const char* extensions()
  • Parameters: None
  • Returns: const char* — The current accepted file extensions or MIME types.
💡

The File Upload Card does not provide a callback for file upload events. It only allows you to set the upload URL and filter selectable file types.

Reference

// ... dash::FileUploadCard fileUpload(dashboard, "Upload", ".txt"); void setup() { // ... fileUpload.setValue("/upload-endpoint"); fileUpload.setExtensions(".txt,.jpg"); } void loop() { // ... }
Last updated on
Copyright © 2025 Softt. All rights reserved.