Attachment Validation Application

Last modified by Admin on 2026/10/03 00:13

cogUser Interface for the attachments validation
TypeXAR
CategoryApplication
Developed by

XWiki Development Team

Active Installs6877
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Compatibility

14.10RC1+

Success

Installable with the Extension Manager

Description

The Attachment Validation Application provides the UI and Configuration of the attachment validation extension.
This extension also provides the client-side validations for the size and mime type attachment validations.

Related pages:

Administration

The mimetypes allowed or blocked can be configured for the whole farm, for one wiki, or for one Page and the Pages below it.

xwiki.properties

Moved to Restrict Attachments by Mimetype for a Whole Farm.

Administration UI

Moved to Restrict Attachments by Mimetype and Restrict Attachments by Mimetype on a Page Tree.

Javascript

An new event is triggered when an attachment is uploaded: xwiki:actions:beforeUpload. An object with a single file key is passed along the event, giving access to the file that must be validated.
A listener can mark the attachment as invalid by calling event.preventDefault().

The example below is a validator that always block the upload of any attachment, and display an error message after each upload.

$(document).on('xwiki:actions:beforeUpload', function (event, data) {
  new XWiki.widgets.Notification("Upload nothing", "error");
  event.preventDefault();
})

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Dependencies

Dependencies for this extension (org.xwiki.platform:xwiki-platform-attachment-validation-ui 18.8.0):

Get Connected