View source for Upload Files

Also available in ((/Doc/Deutsch/Aktionen/DateienHochladen Deutsch)), ((/Doc/Español/Acciones/SubirArchivos Español)), ((/Doc/Français/Fonctions/Telechargements Française)), ((/Doc/Русский/Действия/Uploads Русский)), ((/Doc/简体中文/Actions组件/文件上传 简体中文))

{{toc numerate=1}} 

%%(info type="note")
Non-mandatory options and parameters are enclosed in ##[square brackets]##.
**!!(green)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"##.
%%

===Action===

====upload====

  * Form for file upload to a page or into global space
  * Invoke: ##""{{upload [global=1] [maxsize=200] [hide_description=1]}}""##
  * Parameters:
    * ##global## — this option allows uploaded files to be globally available for all users
    * ##maxsize## — forcedly limits maximum size (must be less than in config)
    * ##hide_description## —  not to show text field "description", there remains only field for the file

**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):
%%(ini)
upload_max_filesize = 32M
post_max_size = 32M
max_execution_time = 300
%%

====files====

  * shows uploaded files for a specific page or global space
  * Call: ##""{{files [page="PageName" or global=1 or all=1 or linked=1] [order="ext|ext_desc|name_desc|size|size_desc|time|time_desc"] [owner="UserName"] [media=1] [max=Number] [nomark=1]}}""##
  * Parameters:
    * ##page## — define the name of the page, from which the list of files is to be loaded. If global=1, list of global space will be shown
    * ##order## — sort file list by time, name, name_desc, size, size-in-reverse-order, and file extension
    * ##owner## — show files owned by a specific user
    * ##media## — parses image, audio and video links into their media tags — similar to a gallery
    * ##nomark## — if set to 1, no border around the query result will be shown

===Syntax of reference to the file===
Local uploaded files, attached to a page, were check against the pages read permission.  

====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 that was attached to a specific page 
    * without rewrite-mode it looks like:
    * ##~https://example.com/?page=Dev/ToDo/Upload/file&get=archive.zip##

====Wacko syntax====

does search
  1. ##~file:archive.zip## - checks for local file, that is only available to readers of this page
  1. ##~file:/archive.zip## - only the global file 
  1. ##~file:!/archive.zip## - for local file with relative path
  1. ##~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.

=====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

Example:
##~file:/Groups/WackoWiki/mammut_800.jpg?500&caption##
file:/Groups/WackoWiki/mammut_800.jpg?500&caption

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

file:/lotus_flower.jpg?caption&400

file:/41265046264_720p.mp4?caption

file:/kimiko_ishizaka___bach___well_tempered_clavier_book_1___01_prelude_no._1_in_c_major_bwv_846.ogg?caption

===File storage on server===
Files for all users (global)
**file/global/**
  graphics.png
  letter.odt

Files of specific pages
**file/perpage/**
  @[page_id]@picture.jpg
  @[page_id]@handbook.pdf
  @[page_id]@calculation.ods

Files after backup (admin panel)
**file/backup/**


===Customize upload settings===
====Edit constants: ((/Doc/English/Configuration config.php))====
**constants.php**
%%(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

====((/Doc/English/Configuration Edit secondary config))====
#|
*| config setting | value | description |*
|| ##check_mimetype## | true | check MIME type ||
|| ##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_translit## | true | transliterate file names ||
|| ##upload_translit_lower## | false | convert file names to lowercase ||
|| ##upload_allowed_exts## |  | allowed file types ||
|| ##upload_banned_exts## | php, cgi, js, php, php3, php4, php5, ... |  ||
|#

file:/ap_upload_settings_en.png