Upload Files
Also available in Deutsch, Español, Française, Русский, 简体中文
[square brackets].When using the actions please remove the square
[ ] brackets from the parameters to make it work.Numerical values are given without and strings with quotation marks,
max=10 and page="PageName".
To display all available parameters of an action, use help=1 (e.g. {{upload help=1}} or {{files help=1}}).
1. Action
1.1. upload
- Form for file upload to a page or into global space
- Invoke:
{{upload [global=0] [maxsize=200] [hide_description=0] [rename=0]}} - Parameters:
-
global— this option allows uploaded files to be globally available for all users. Default is 0 = the file is attached to the current page (local name space). -
maxsize— forcibly limits the maximum size of the uploaded file. The value must be smaller than the configured maximum; it can only lower the limit, never raise it. The effective maximum shown in the form is the smaller of the configured maximum and this value. -
hide_description— if set to 1, the text field "description" is not shown, there remains only the field for the file. Default is 0 = the description field is shown. -
rename— if set to 1, an additional field for renaming the uploaded file is displayed (this option is not listed in the built-in help of the action).
-
- Permissions: users who have neither read, write nor upload rights on the current page -- and who are not administrators -- are automatically switched to the global upload. If uploading is not allowed at all, the action displays the message "Upload forbidden" instead of the form.
- File types: with the setting
upload_images_onlyonly image files (bitmap formats) can be uploaded; administrators are exempt from this restriction. Withupload_allowed_extsthe file selection is restricted to the listed extensions.
Note : Please keep in mind that files might be rejected based on other criteria, for example lack of disk space, because the file is larger than the maximum allowed file size or because your web-host does not allow particular files.
If you’d like to allow larger files, you’ll need to edit the PHP configuration file (php.ini) and add or set the following lines in php.ini (the example allows files up to 32 Mb):
upload_max_filesize = 32M
post_max_size = 32M
max_execution_time = 300
Keep in mind that the wiki enforces its own limit independently of PHP: the effective maximum is derived from the configuration (upload_max_size) and can be lowered per call with maxsize.
1.2. files
- shows uploaded files for a specific page or global space
- Call:
{{files [page="PageName"] [global=1] [all=1] [linked=1] [cluster=1] [order="name"] [form=1] [options=0] [owner="UserName"] [media=1] [max=Number] [nomark=0]}} - Parameters:
-
page— define the name of the page, from which the list of files is to be loaded. Without this parameter the files of the current page are listed. -
global=1— list of the global name space is shown. -
all=1— all attachments of the wiki are listed, including global files. -
linked=1— only the files that are linked from the current page. -
cluster=1— the attachments of all pages of the cluster (all subpages of the current page). -
order— sort file list by file extension, time, name, size and their reverse order:ext,ext_desc,name_desc,size,size_desc,time,time_desc. Default isname(file name ascending). -
form=1— show the search form with a phrase field. -
options— show sort & filter options (language, user, MIME type, categories). -
owner— show files uploaded by a specific user. -
media— parses image, audio and video links into their media tags — similar to a gallery. With this option wide images are additionally served as thumbnails (?450) when thumbnail creation is enabled. -
max=Number— maximum number of files shown per page. -
nomark— if set to 1, no border around the query result will be shown.
-
- Additional filters are passed through the query string and are used by the form:
?phrase=...,?lang=...,?user_id=...,?mime=...,?category_id=...,?type_id=...,?dir=asc|desc,?order=.... - The read permission of the page a file belongs to is checked; files of pages that are not readable are omitted. Administrators, the owner of the page and the uploader of the file additionally get the file tools (show properties, edit properties, remove), which lead to the
filemetahandler (?m=show|edit|remove&file_id=…).
2. Syntax of reference to the file
Local uploaded files, attached to a page, were check against the pages read permission.
The actions themselves generate the following forms:
-
file:/<Tag>/<filename>— media reference to a file attached to a page (used withmedia=1) -
_file:/<Tag>/<filename>— plain link to a file attached to a page (used withoutmedia) -
file:/<filename>— media reference to a file in the global name space -
_file:/<filename>— plain link to a file in the global name space
2.1. URL syntax
-
https://example.com/file/global/archive.zip— file in the global name space -
https://example.com/Dev/ToDo/Upload/file?get=archive.zip— file attached to a specific page- without rewrite-mode it looks like:
-
https://example.com/?page=Dev/ToDo/Upload/file&get=archive.zip
- the *file* handler also accepts the parameter
tbn=<width>x<height>for requesting a thumbnail of the given size (used by thegalleryaction).
2.2. Wacko syntax
-
file:archive.zip- searches for local files that are only available to users who are allowed to read this page -
file:/archive.zip- only the global file -
file:!/archive.zip- for local file with relative path -
file:/Subpage/archive.zip- for local file with absolute path, necessary for local files to be included in another page
The absolute path is only needed if you want to embed a locally attached file in another page. This is rather rare, as the user usually embeds the file in the same page. In this case, the relative syntax should always be the preferred option, as it is not only shorter but also works after the page to which the file is attached has been renamed.
2.2.1. Media Parameters
Parameters are added to the file syntax by appending a question mark ? and adding additional parameters by an ampersand &.
e.g. file:/image.png?200x400&direct&caption
- linking
-
direct- to file -
nolink- shows only the image -
linkonly- shows only link -
meta- to filemeta handler (default)
-
- alignment
-
right -
left -
center
-
- resizing
-
400x300- width x height -
0x700- height -
600- width
-
- others
-
caption- shows caption -
clear- clears float
-
Note: the direct, nolink, linkonly, meta, alignment, resizing, caption and clear options are evaluated by the page formatter and not by the actions themselves; the only parameter produced by the files action is the thumbnail suffix ?450 (and the ?tbn=… parameter of the *file* handler used by the gallery action).
Example:
file:/Groups/WackoWiki/mammut_800.webp?500&caption
2.3. Embedding media files
Media files are rendered in their media tag such as <image>, <audio> or <video> unless otherwise declared.
(Source:: Yoshikazu TAKADA /Some rights reserved)
(Source:: NPS / Dale Bohlke /Public domain)
(Source:: Composer: Johann Sebastian Bach; Performer: Kimiko Ishizaka /Public domain)
3. File storage on server
Files for all users (global), directory UPLOAD_GLOBAL_DIR:
file/global/
letter.odt
Files of specific pages, directory UPLOAD_LOCAL_DIR, the page id is part of the file name:
file/perpage/
@[page_id]@handbook.pdf
@[page_id]@calculation.ods
Files after backup (admin panel), directory UPLOAD_BACKUP_DIR:
file/backup/
Thumbnails are stored separately: global thumbnails in THUMB_DIR, thumbnails of page files in THUMB_LOCAL_DIR. Both directories are purged by the admincache action.
4. Customize upload settings
4.1. Edit constants: config.php
constants.php
<?php
...
const UPLOAD_GLOBAL_DIR = 'file/global';
const UPLOAD_LOCAL_DIR = 'file/perpage';
const UPLOAD_BACKUP_DIR = 'file/backup';
... -
UPLOAD_GLOBAL_DIR— where are placed the public files -
UPLOAD_LOCAL_DIR— where are placed files only for users allowed to view current page, attached to the concrete pages
4.2. Edit secondary config
The following settings are used by the upload and files actions (verified in the action sources):
| config setting | value | description |
|---|---|---|
upload |
true | who can upload. Anonymous users cannot upload ever |
attachments_handler |
2 | enables the upload section in the user profile |
upload_images_only |
true | if established, then it does not give to load something besides pictures. Pictures are determined with the aid of GD. Administrators are exempt |
upload_allowed_exts |
allowed file types; restricts the file selection of the upload form | |
upload_max_size |
the maximum permissible size of the file (the value is interpreted by the configuration code; the upload form displays it in binary multiples) | |
upload_quota |
0 | is how much Byte can be uploaded at all (if it is not established, then as much as desired) |
upload_quota_per_user |
500000 | is how much Byte can be uploaded by one user (if it is not established, then as much as desired) |
create_thumbnail |
true | creates thumbnails for wide images (?450) when the file list is shown as media |
max_thumb_width |
maximum width of the generated thumbnails (used by the gallery action) |
The following settings belong to the upload handling as well, but are not referenced by the actions themselves (they are processed by the upload handler / configuration):
| config setting | value | description |
|---|---|---|
check_mimetype |
true | check MIME type |
default_upload_acl |
Admins | who can upload. Anonymous users cannot upload ever |
upload_translit |
true | transliterate file names |
upload_translit_lower |
false | convert file names to lowercase |
upload_banned_exts |
php, cgi, js, php, php3, php4, php5, ... |
Note: the MIME type is stored with every file record. For records created before the MIME type was introduced, the type can be filled in afterwards with the adminupdate action; the files action can filter the list by MIME type.
4.3. Page upload permissions
The page owner or admin can further restrict the file upload to a particular page via page permissions.

![WackoWiki Permissions [access control lists] (25.4 KiB) WackoWiki Permissions [access control lists]](/doc/file/global/wackowiki_r6_en_permissions.png)