WackoWiki: 文件上传

https://wackowiki.org/doc     Version: 12 (12.04.2023 09:51)


其他语言 Deutsch[link1], English[link2], Español[link3], Française[link4], Русский[link5]


English -> 简体中文


Not necessarily required data and parameters are in [square brackets].
Use action parameters without square brackets [ ].

1. Action

1.1. upload

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	

1.2. files

2. Syntax of reference to the file

Local uploaded files, attached to a page, were check against the pages read permission.

2.1. URL syntax

2.2. Wacko syntax

does search
  1. file:archive.zip - checks for local file, that is only available to readers of this page
  2. file:/archive.zip - only the global file
  3. file:!/archive.zip - for local file with relative path
  4. 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 include a local attached file into another page, which is rather an exception, in the majority of cases the user will embed the file in the same page. In this case the relative syntax should always be the preferred option, it is not only shorter, but also works after the page the file is attached to has been renamed.

2.2.1. 媒体参数

通过附加问号? 并通过与号& 添加附加参数,将参数添加到文件语法中。
例如: file:/image.png?200x400&direct&caption

The Woolly Mammoth (Elephas primigenius)
We try to respect the hunter that dominated the first 99.9% of the history of our species. If you had to kill a mammoth or do without supper, there was no time to draw up an organization chart, assign tasks, or delegate authority. Basically, the person who saw the mammoth from farthest away was the Official Sighter, the one who ran fastest was the Head Runner, whoever threw the most accurate spear was the Grand Marksman, and the person all others respected most and listened to was the Chief. That’s all there was to it. Distributing little charts to produce an appearance of order would have been a waste of time. It still is.

2.3. Embedding media files

Media files are rendered in their media tag such as <image>, <audio> or <video> unless otherwise declared.

Lotus Flower
Shinobazu Pond at Ueno Park at Ueno, Taito-ku in Tokyo
(Source:: Yoshikazu TAKADA /Some rights reserved)

Sandhill Cranes
(Source:: NPS / Dale Bohlke /Public domain)

Johann Sebastian Bach - Well-Tempered Clavier, Book 1 - 01 Prelude No. 1 in C major, BWV 846
(Source:: Composer: Johann Sebastian Bach; Performer: Kimiko Ishizaka /Public domain)

3. File storage on server

Files for all users (global)

Files of specific pages

Files after backup (admin panel)

4. Customize upload settings

4.1. Edit constants: config.php[link6]


UPLOAD_GLOBAL_DIR                'file/global';
UPLOAD_PER_PAGE_DIR            'file/perpage';
UPLOAD_BACKUP_DIR                'file/backup';

4.2. Edit secondary config[link6]

config setting value description
default_upload_acl Admins who can load. Anonymous authors cannot load ever
upload true who can load. Anonymous authors cannot load ever
upload_images_only true if is established, then it does not give to load something besides pictures. Pictures are determined with the aid of GD
upload_max_size 100 the maximum permissible size of file, in Bytes
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)
upload_banned_exts php, cgi, js, php, php3, php4, php5, ...