☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

Comma Separated Accepts Mime Types

Table of contents

Description:

This key represents a comma-separated string format for the accepts_mime_types key that restricts which file types are available to select or upload in File Inputs.

The value is a string containing MIME types separated by commas. Each MIME type specifies a file type that CloudCannon will allow for this input.

Available MIME types include image formats (image/x-icon, image/gif, image/jpeg, image/png, image/webp, image/bmp, image/svg+xml) and document formats (application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation).

Use the comma-separated format when you prefer a more compact configuration or when working with a small number of MIME types.

The special value "*" means any file type is accepted.

Appears in:
└── accepts_mime_types
    └── Comma Separated Accepts Mime Types
Type:
string
Examples:

In this example, we have configured a File Input to accept only image files using a comma-separated string of image MIME types.

Copied to clipboard
_inputs:
  hero_image:
    type: file
    label: Hero Image
    options:
      accepts_mime_types: image/jpeg,image/png,image/webp
{
  "_inputs": {
    "hero_image": {
      "type": "file",
      "label": "Hero Image",
      "options": {
        "accepts_mime_types": "image/jpeg,image/png,image/webp"
      }
    }
  }
}

In this example, we have configured a File Input to accept only document files using a comma-separated string of document MIME types.

Copied to clipboard
_inputs:
  document:
    type: file
    label: Document
    options:
      accepts_mime_types: application/pdf,application/msword
{
  "_inputs": {
    "document": {
      "type": "file",
      "label": "Document",
      "options": {
        "accepts_mime_types": "application/pdf,application/msword"
      }
    }
  }
}

In this example, we have configured a File Input to accept any file type using the special "*" value.

Copied to clipboard
_inputs:
  any_file:
    type: file
    label: Any File
    options:
      accepts_mime_types: '*'
{
  "_inputs": {
    "any_file": {
      "type": "file",
      "label": "Any File",
      "options": {
        "accepts_mime_types": "*"
      }
    }
  }
}
Open in a new tab