]> sipb.mit.edu Git - ikiwiki.git/blob - doc/ikiwiki/pagespec/attachment.mdwn
Merge branch 'dependency-types'
[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 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:
13   
14         virusfree() and ((user(joey) and podcast/*.mp3 and mimetype(audio/mpeg) and maxsize(15mb)) or (!ispage() and maxsize(50kb)))
15
16 The regular [[ikiwiki/PageSpec]] syntax is expanded with the following
17 additional tests:
18
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.
22   
23 * "`minsize(size)`" - tests whether the attachment is no smaller than the
24   specified size.
25
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
28   page format).
29
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()`.
33
34 * "`mimetype(foo/bar)`" - checks the MIME type of the attachment. You can
35   include a glob in the type, for example `mimetype(image/*)`.
36
37 * "`virusfree()`" - checks the attachment with an antiviral program.