Attachment Validation Application
User Interface for the attachments validation |
Type | XAR |
Category | Application |
Developed by | |
Active Installs | 1 |
Rating | |
License | GNU Lesser General Public License 2.1 |
Bundled With | XWiki Standard |
Compatibility | 14.10RC1+ |
Table of contents
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 mimetype allowed/blocked on a space can be configured.
xwiki.properties
xwiki.properties allow to configure the default mimetype restrictions at farm level.
#-# Define the list of allowed attachment mimetypes. By default, this list is empty, but you can specify a
#-# comma-separated list of allowed mimetypes. Note that a joker (*) can be used to accept any media type. Once this
#-# list is not empty, any attachment with an unlisted mimetype will be rejected.
#-# For instance, if you want to only accept plain text and any kind of images, you can set the list to:
#-# text/plain,image/*
# attachment.upload.allowList=
#-# [Since 14.10RC1]
#-# Define the list of blocked attachment mimetypes. By default, this list is empty, but you can specify a
#-# comma-separated list of blocked mimetypes. Note that a joker (*) can be used to accept any media type. Once this
#-# list is not empty, any attachment matching one of the listed mimetype will be rejected.
#-# For instance, if you want to reject plain text and any kind of images, you can set the list to:
#-# text/plain,image/*
#-#
# attachment.upload.blockList=
Administration UI
The mimetype restrictions can also be configured at wiki or space level through the administration UI, by visiting the Attachments Restriction section of the administration.
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.
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:
- Log in the wiki with a user having Administration rights
- Go to the Administration page and select the Import category
- Follow the on-screen instructions to upload the downloaded XAR
- Click on the uploaded XAR and follow the instructions
- 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 16.10.1):
- org.xwiki.platform:xwiki-platform-attachment-validation-default 16.10.1