1 [[!meta robots="noindex, follow"]]
2 [[!if test="enabled(attachment)"
3 then="This wiki has attachments **enabled**."
4 else="This wiki has attachments **disabled**."]]
6 If attachments are enabled, the wiki admin can control what types of
7 attachments will be accepted, via the `allowed_attachments`
10 For example, to limit arbitrary files to 50 kilobytes, but allow
11 larger mp3 files to be uploaded by joey into a specific directory, and
12 check all attachments for viruses, something like this could be used:
14 virusfree() and ((user(joey) and podcast/*.mp3 and mimetype(audio/mpeg) and maxsize(15mb)) or (!ispage() and maxsize(50kb)))
16 The regular [[ikiwiki/PageSpec]] syntax is expanded with the following
19 * "`maxsize(size)`" - Tests whether the attachment is no larger than the
20 specified size. The size defaults to being in bytes, but "kb", "mb", "gb"
21 etc can be used to specify the units.
23 * "`minsize(size)`" - Tests whether the attachment is no smaller than the
26 * "`ispage()`" - Tests whether the attachment will be treated by ikiwiki as a
27 wiki page. (Ie, if it has an extension of ".mdwn", or of any other enabled
30 So, if you don't want to allow wiki pages to be uploaded as attachments,
31 use `!ispage()` ; if you only want to allow wiki pages to be uploaded
32 as attachments, use `ispage()`.
34 * "`mimetype(foo/bar)`" - This checks the MIME type of the attachment. You can
35 include a glob in the type, for example `mimetype(image/*)`.
37 * "`virusfree()`" - Checks the attachment with an antiviral program.