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

Array Accepts Mime Types

Table of contents

Description:

This key represents an array format for the accepts_mime_types key that restricts which file types are available to select or upload in File Inputs.

The value is an array of MIME type strings. Each string 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 array format when you want to explicitly list multiple MIME types, making it easier to read and maintain in your configuration.

Appears in:
└── accepts_mime_types
    └── Array Accepts Mime Types
Type:
Array<accepts_mime_types(array)[*]>
Items:
[*]string#

This key represents an array format for the accepts_mime_types key that restricts which file types are available to select or upload in File Inputs.

The value is an array of MIME type strings. Each string 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 array format when you want to explicitly list multiple MIME types, making it easier to read and maintain in your configuration.

Allowed values: x-world/x-3dmf application/x-authorware-bin application/x-authorware-map application/x-authorware-seg text/vnd.abc video/animaflex application/postscript audio/aiff audio/x-aiff application/x-aim and 423 more.

Show examplesHide examples

In this example, we have configured a File Input to accept only image files using an array 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 an array of document MIME types.

Copied to clipboard
_inputs:
  document:
    type: file
    label: Document
    options:
      accepts_mime_types:
        - application/pdf
        - application/msword
        - >-
          application/vnd.openxmlformats-officedocument.wordprocessingml.document
{
  "_inputs": {
    "document": {
      "type": "file",
      "label": "Document",
      "options": {
        "accepts_mime_types": [
          "application/pdf",
          "application/msword",
          "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
        ]
      }
    }
  }
}
Examples:

In this example, we have configured a File Input to accept only image files using an array 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 an array of document MIME types.

Copied to clipboard
_inputs:
  document:
    type: file
    label: Document
    options:
      accepts_mime_types:
        - application/pdf
        - application/msword
        - >-
          application/vnd.openxmlformats-officedocument.wordprocessingml.document
{
  "_inputs": {
    "document": {
      "type": "file",
      "label": "Document",
      "options": {
        "accepts_mime_types": [
          "application/pdf",
          "application/msword",
          "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
        ]
      }
    }
  }
}
Open in a new tab