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 most users to uploading small images, and nothing else,
11 while allowing larger mp3 files to be uploaded by joey into a specific
12 directory, and check all attachments for viruses, something like this could be
15 virusfree() and ((user(joey) and podcast/*.mp3 and mimetype(audio/mpeg) and maxsize(15mb)) or ((mimetype(image/jpeg) or mimetype(image/png)) and maxsize(50kb)))
17 The regular [[ikiwiki/PageSpec]] syntax is expanded with the following
20 * "`maxsize(size)`" - tests whether the attachment is no larger than the
21 specified size. The size defaults to being in bytes, but "kb", "mb", "gb"
22 etc can be used to specify the units.
24 * "`minsize(size)`" - tests whether the attachment is no smaller than the
27 * "`ispage()`" - tests whether the attachment will be treated by ikiwiki as a
28 wiki page. (Ie, if it has an extension of ".mdwn", or of any other enabled
31 So, if you don't want to allow wiki pages to be uploaded as attachments,
32 use `!ispage()` ; if you only want to allow wiki pages to be uploaded
33 as attachments, use `ispage()`.
35 * "`mimetype(foo/bar)`" - checks the MIME type of the attachment. You can
36 include a glob in the type, for example `mimetype(image/*)`.
38 * "`virusfree()`" - checks the attachment with an antiviral program.