]> sipb.mit.edu Git - ikiwiki.git/blob - doc/ikiwiki/pagespec/attachment.mdwn
Merge remote-tracking branch 'anarcat/osm-fixes'
[ikiwiki.git] / doc / ikiwiki / pagespec / attachment.mdwn
1 [[!meta robots="noindex, follow"]]
2 [[!if test="enabled(attachment)"
3      then="This wiki has attachments **enabled**."
4      else="This wiki has attachments **disabled**."]]
5
6 If attachments are enabled, the wiki admin can control what types of
7 attachments will be accepted, via the `allowed_attachments`
8 configuration setting.
9
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
13 used:
14   
15         virusfree() and ((user(joey) and podcast/*.mp3 and mimetype(audio/mpeg) and maxsize(15mb)) or (mimetype(image/*) and maxsize(50kb)))
16
17 The regular [[ikiwiki/PageSpec]] syntax is expanded with the following
18 additional tests:
19
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.
23   
24 * "`minsize(size)`" - tests whether the attachment is no smaller than the
25   specified size.
26
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
29   page format).
30
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()`.
34
35 * "`mimetype(foo/bar)`" - checks the MIME type of the attachment. You can
36   include a glob in the type, for example `mimetype(image/*)`.
37
38 * "`virusfree()`" - checks the attachment with an antiviral program.