Overview

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

Document Attachments are a concept of attaching files to documents in Kentico CMS. This concept greatly simplifies the way you work with files. Each document can have any number of attached files, which is a great step forward compared to the previous use of the File field, which allowed only one uploaded file per one defined File field.

 

Attachments are directly bound to a document's life cycle. So if a document gets published, its attachments get published too. If you delete a document, its attachments will also be deleted.

 

You can find a live example of document attachments on the sample Corporate Site. If you enter the News section and display some of the news items, you can see the images at the bottom of the page, as highlighted in the screenshot below. These are the attachments of the news document displayed by the Attachment image gallery web part.

 

devguide_clip0841

 

There are two types of attachments:

 

Unsorted - added via the Properties -> Attachments tab; using this approach, you can easily add attachments to any document; all attachments added this way are taken as one group and displayed together using the web parts
Grouped - added by defining a 'Document attachments' field for a document type and then uploading a file on a document's Form tab; for each Document attachments field, you can have an unlimited number of files attached; you can also define more fields of this type to have several groups of attachments which can be displayed separately on the live site
File field - another type of field that can be used for file upload via the Form tab; the difference from Grouped attachments is that only one file ca be uploaded into one File field

 

The attachments can be displayed with the document using one of the following web parts:

 

Attachment image gallery - using the default transformation, the web part displays thumbnails of document's image attachments; after clicking a thumbnail, lightbox will open, displaying the attachment in a full size; for non-image attachments, file type icon will be displayed instead, while after clicking it, users are able to download the file; of course, you can modify this behaviour by defining your own transformation
Document attachments - displays a list of document's attachments; after clicking an attachment, it is opened in a new window or offered for download in case that it is not an image
Attachments data source - data source web part for providing attachments to a connected displaying web part; see also Using DataSource web parts

 

More information about the web parts can be found in this chapter.

 

You can also display document's unsorted attachments using the following two inline controls that can be added via the Editable text web part:

 

Attachment image gallery - displays the document's unsorted attachments' thumbnails; after clicking the thumbnail, the attachment will be displayed in a lightbox
Document attachments - displays the document's unsorted attachments; after clicking the thumbnail, image attachment will be displayed on a new page and non-image attachments will be offered for download

 

More information about the inline controls can be found in this chapter.

 

Page url: http://devnet.kentico.com/docs/devguide/index.html?attachments_overview.htm