File Upload

premium

Single file upload with type and size validation.

Overview

The File Upload component lets users select or drag-and-drop a single file. Validates file type (by MIME type or extension) and file size with configurable limits.

Properties

PropertyTypeDefaultDescription
nameString"file"Field name used in form data.
labelString"Upload File"Label displayed above the upload area.
acceptString--Accepted file types (e.g., ".pdf,.doc" or "image/*").
maxSizeNumber5Maximum file size in MB.
requiredBooleanfalseWhether a file must be uploaded.

Features

  • Click or drag-and-drop file selection
  • File type validation (MIME type or extension)
  • File size validation (configured in MB)
  • File preview with name and size display
  • Remove button to clear selection

Tips

The maxSize property is in MB (e.g., 5 = 5MB).
Use accept to restrict file types: ".pdf,.doc" for specific extensions, "image/*" for all images.

Validation

This component uses file validation. See the Validation Guide for details on configuring rules and error messages.

Related components