1 (I've written a [[proposal|todo/fileupload/soc-proposal]] for this feature --Ben).
3 Support for uploading files is useful for many circumstances:
6 * Uploading local.css files (admin only).
7 * Uploading mp3s for podcasts.
10 ikiwiki should have an easy to use interface for this, but the real meat of
11 the work is in securing it. Several classes of controls seem appropriate:
13 * Limits to size of files that can be uploaded. Prevent someone spamming
14 the wiki with CD isos..
15 * Limits to the type of files that can be uploaded. To prevent uploads of
16 virii, css, raw html etc, and avoid file types that are not safe.
17 Should default to excluding all files types, or at least all
18 except a very limited set, and should be able to open it up to more
21 Would checking for file extensions (.gif, .jpg) etc be enough? Some
22 browsers are probably too smart for their own good and may ignore the
23 extension / mime info and process as the actual detected file type. It
24 may be necessary to use `file` to determine a file's true type.
25 * Optional ability to test a file using a virus scanner like clamav.
26 * Limits to who can upload what type of files.
27 * Limits to what files can be uploaded where.
29 It seems that for max flexability, rules should be configurable by the admin
30 to combine these limits in different ways. If we again extend the pagespec
31 for this, as was done for [[conditional_text_based_on_ikiwiki_features]],
32 the rules might look something like this:
34 ( maxsize(30kb) and type(webimage) ) or
35 ( user(joey) and maxsize(1mb) and (type(webimage) or *.mp3) ) or
36 ( user(joey) and maxsize(200mb) and (*.mov or *.avi) and videos/*)
38 With a small extension, this could even be used to limit the max sizes of
39 normal wiki pages, which could be useful if someone was abusing an open wiki
42 ( type(page) and maxsize(32k) )
44 And if that's done, it can also be used to lock users from editing a pages
47 !(( user(spammer) and * ) or
48 ( user(42.12.*) and * ) or
49 ( user(http://evilopenidserver/*) and * ) or
50 ( user(annoying) and index) or
53 That would obsolete the current simple admin prefs for banned users and
54 locked pages. Suddenly all the access controls live in one place.
57 (Note that pagespec_match will now return an object that stringifies to a
58 message indicating why the pagespec matched, or failed to match, so if a
59 pagespec lock like the above prevents an edit or upload from happening,
60 ikiwiki could display a reasonable message to the user, indicating what