Wiki source code of Attachments
Last modified by superadmin on 2026/10/14 18:26
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | Any page of a wiki can carry files as attachments, a core feature that the [[Attachment API>>doc:extensions:Extension.Attachment.API.WebHome]] and the modules around it provide. [[Users attach>>doc:documentation.xs.user.attachments.WebHome]] and manage them from the "Attachments" tab of a Page, and administrators decide what may be uploaded and where it is stored. | ||
| 2 | |||
| 3 | Two macros let a Page ask its reader for one of those attachments: the [[attachmentGalleryPicker macro>>doc:documentation.xs.dev.attachments.attachmentgallerypicker-macro.WebHome]] searches the attachments of the wiki and hands the choice to a script, and the [[attachmentSelector macro>>doc:documentation.xs.dev.attachments.attachmentselector-macro.WebHome]] writes it into an xobject property. The [[Attachment Picker Application>>doc:documentation.xs.dev.attachments.attachment-picker-application.WebHome]] ships what the first of them needs to look and behave like a picker, and the tab that puts it in the image dialog of the WYSIWYG editor; the [[Attachment Picker WebJar>>doc:documentation.xs.dev.attachments.attachment-picker-webjar.WebHome]] holds the JavaScript that does the searching and the picking. | ||
| 4 | |||
| 5 | A file picked for upload is offered to the JavaScript of the page before it is sent, so that an extension may refuse it: [[Client-Side Attachment Validation>>doc:documentation.xs.dev.attachments.client-side-validation.WebHome]] documents that event and what a listener may do with it. Whatever the browser decided, the server examines the file again before saving it, along the chain the [[Attachment Validation API>>doc:documentation.xs.dev.attachments.validation-api.WebHome]] describes; the limits that chain enforces are read through the [[Attachment Validation Configuration API>>doc:documentation.xs.dev.attachments.validation-configuration-api.WebHome]], and shipping a check of your own takes one component: [[Add an Attachment Validation Step>>doc:documentation.xs.dev.attachments.add-validation-step.WebHome]]. |