☁️
Drop Upload
Go to website
  • πŸ‘‹Getting Started
  • βš™οΈInstallation
  • πŸ“€Usage
    • πŸ“„File validation
      • Allowed formats
      • Size limits
    • 🎨Customization
Powered by GitBook
On this page
  • Wildcards
  • Multiple formats
  • Formats Label Customization
  1. Usage
  2. File validation

Allowed formats

Define your own list of permitted formats

PreviousFile validationNextSize limits

Last updated 25 days ago

The allowed formats are based on MIME types, which define the nature and format of a file. You can refer to the official or (recommended) to check the available MIME types.

Accept only PNG, JPG and BMP files
<DropUpload allowedFormats={[
    "image/png",
    "image/jpeg",
    "image/bmp",
]} />

Wildcards

If you want to allow all image formats, you can use image/*. The same applies to video, application, audio, font, etc.

Users will then be prompted to select "any image file" instead of "JPG or PNG files".

<DropUpload allowedFormats={["image/*"]} />


Multiple formats

Different file formats and wildcards can be combined in the allow list.

<DropUpload allowedFormats={[
    "image/png", // .png
    "image/jpeg",
    "image/bmp",
    "video/*", // Any video
    "audio/*", // Any audio
    "font/ttf",
    "font/otf"
]} />


Formats Label Customization

Label: Custom text

When you specify a list of allowed formats, an automatic text is generated that will appear in the user’s UI, indicating which image formats they can upload. For example, β€œJPG, PNG, or GIF.” However, you can choose to provide your own text, such as β€œCute cat pics only.”

<DropUpload
    allowedFormats={['image/jpeg']}
    allowedFormatsLabelMode="custom"
    allowedFormatsLabelCustomText="Cute cat pics only!"
/>


Label Mode

The generated text is created based on the allowed MIME types. By default, the most popular format for each MIME type is selected and displayed. However, some MIME types encompass more than one file extension. You can choose to display just one, the entire group of file extensions, a custom text, or nothing at all.

<DropUpload
    allowedFormats={['image/heic']}
    allowedFormatsLabelMode="auto-full" // .heif AND .heic
/>
Mode
Description
Example (image/jpeg)

auto (default)

Suggest the most important extension for the MIME type in text (the other extensions of the MIME will be valid as well)

JPG

auto-full

Suggest the entire list of extensions for the MIME Type

.jpe, .jpeg, .jpg, .pjpg, .jfif, .jfif-tbnl, .jif

custom

Personalized text

Cute cat pics only!

off

Hide the text

πŸ“€
πŸ“„
IANA Media Types list
https://mimetype.io/all-types