Binary Field documentation for the dotCMS Content Management System

Adding a Binary Field to a Content Type allows the user to embed and store any file directly in the content itself without placing that file in the Site Browser hierarchy.

Adding a binary field

Comparison of Binary Fields vs. Image and File Fields

You may add images or files to a Content Type using either Binary fields, or the Image and File fields. The difference is that Binary fields store the file or image inside the content itself, while Image and File fields store the file or image as a separate content item, which is then linked to from the Image or File field.

Binary Field Advantages

The advantages of using a Binary field instead of an Image or File field are:

  • The file can be edited from the contentlet itself.
  • Only users that have permissions to view or edit the content will have access to view or modify the file associated with the content.
  • Improved performance with dynamic pulls.

Binary Field Disadvantages

The disadvantages of using Binary field are:

  • Since the file does not exist in any folder location within the Site Browser, a directory path cannot be passed to a photo gallery, video gallery, file repository, etc.
  • The file can not be re-used in multiple content items.
  • The file can't be displayed in bulk (by viewing a site or folder containing multiple files).

Field Variables

You may add Field Variables to Binary fields to limit both the size and types of files which can be uploaded:

Field Variable KeyExampleDescription
acceptapplication/pdf,image/*A comma-separated whitelist of mimeTypes allowed for uploaded files.
  • May include wildcards in place of specific mimeTypes.
maxFileLength1024The maximum size of uploaded files, in bytes.

Each variable in the Field Variable popup takes both a key and a value