Contents
1 Attachments
1.1 Basics
1.1.1 What does attachments do?
attachments is a service package that associates Content Repository file items with an acs_object, such as a forum message. It is a shared singleton service: one instance serves the applications on the site. Applications use its API directly; they do not need a separate Attachments instance or a mount beneath each application.
1.1.2 At a high-level, how does attachments work?
The application creates or selects a Content Repository file item and associates its item ID with the target object's ID using attachments::attach. How files are uploaded, displayed and authorized is determined by the application's integration.
1.2 Direct attachment workflow
An application can upload a file to the Content Repository and associate it with an existing object:
attachments::attach \
-object_id $object_id \
-attachment_id $item_id
This API does not require Attachments to be mounted below the application, nor does it require a File Storage instance or root-folder mapping. The Attachments service must be installed and enabled. The calling application must check permissions and validate uploads before creating the association.
attachments::unattach removes an association, and attachments::get_attachments retrieves an object's attachments. Richtext integrations can also use attachments::richtext::file_attach to import a file and attach it to an existing object.
1.3 Configuring Forums attachments
For Forums 1.4.3d2 or newer, use the package instance parameter AttachmentStyle=simple (the default). Files are uploaded with the message form and attached directly. An enabled Attachments service is sufficient; no child mount or File Storage mapping is needed.
AttachmentStyle=complex is retained for compatibility with existing legacy configurations. Use simple for new configurations.
In the Forums administration pages, create or edit a forum to configure these independent options:
- Allow image paste: permits pasting PNG, JPEG and GIF images into the Markdown editor. Images appear in Preview before saving and are attached to the message when it is saved. The Markdown editor must be enabled for the message field. Image paste uses the direct workflow with either AttachmentStyle.
- Allow file attachments: permits uploading files through the selected attachment workflow. It is separate from image paste and is not restricted to the image formats accepted by image paste.
Both options default to No for new forums. Upgrading preserves the existing file-attachment setting and initially disables image paste. Either option can be enabled without enabling the other. Disabling image paste prevents new pastes; it does not remove images already attached to messages.
For a public forum, image paste alone can provide inline images without also offering general file uploads. Enable general file attachments only where they are appropriate for the forum.
1.4 News image paste
The News Markdown image-paste integration uses the shared Attachments service directly. It requires richtext-markdown as the editor and attachments::richtext::file_attach; no child mount or File Storage mapping is needed.
Pasted images are staged privately and available in Preview before the article is saved. On save, News imports the images into the Content Repository and attaches them to the article's item ID, rather than to an individual revision. Images therefore remain available across revisions and are deleted with the article.
Release Notes
Please file bugs in the Bug Tracker.