Files Action Documentation

This the documentation page for the Files action.

Note
If the WikkaWiki directory tree is copied or moved from an old system to another system that has SELinux enabled (enforcing) then the copied/moved files and directories may not have the correct SELinux context types. If this is the case, the {{files}} action could be prevented from working correctly by SELinux enforcement even if the owner and permissions are already set correctly.

The actions/files/files.php script file (and possibly other .php files in the WikkaWiki install directory) must have the SELinux context type httpd_sys_script_exec_t to permit use of the PHP file creation routines. Without the correct context on the script, file uploads may fail. From the wiki base install directory, check for the correct SELinux context by entering the command:

ls -Z actions/files/files.php


If the listed SELinux security context type is not httpd_sys_script_exec_t, change it with the command:

chcon -t httpd_sys_script_exec_t actions/files/files.php


Assuming the permissions and owner on the uploads directory are correct, the entire uploads directory tree must have the httpd_sys_script_rw_t SELinux context type so that scripts (.php files) running in the web server process are allowed read/write access. Check this with the command:

ls -dZ uploads


If the listed SELinux security context type is not httpd_sys_script_rw_t, change it with the command:

chcon -R -t httpd_sys_script_rw_t uploads


Thanks to Mike Shultz and http://www.mediawiki.org/wiki/SELinux#Uploading_Images


See | also
Mod for the files action
For the development page, take a look at FilesAction.
FilesActionSafeModeWorkaround
 


Documentation


Short description
Allows admins to manage files (upload, deletion) and everyone to view a list of them or download them. Or it provides a download-link to a single file.

Parameters
nametyperequired?defaultdescription
downloadstringoptionalprints a link to the file specified in the string
textstringoptionala text for the link provided with the parameter "download"


Long description
The 'upload_path' in the wikka_config must be a writeble directory. A directory by each page will be created to store their attached files. This action will only show/modify the files attached to the current page!

If you want to manage the files, use the action without parameters. You will see a list of the files attached to wikka with "attachment" (name of the file)., "size" and "Date added", ordered descending after "Date added". To donload a file, simply click on the name. As an admin, you will see a "x" left to every file (clicking on it will delete the file). The simple form below the list allows to upload a file.

If you specify a filename with the parameter "download", a link to download this file will be shown (you can change the text for the link with the parameter "text") but not the form.

Usage:
{{files [download="filename"] [text="descriptive text"]}}


Upload limits
As for a default install, a limit of 2 Megabyte for the (maximum) size of a file exists. You can find it in

files.php (line 58)
  1. // if(!defined('MAX_UPLOAD_SIZE')) define('MAX_UPLOAD_SIZE', 2097152);
  2. if(!defined('MAX_UPLOAD_SIZE')) define('MAX_UPLOAD_SIZE', 4194304);


If you want to enhance the limit you can do so by changing the file (note that the limit has to be written as a number of bytes).

Please note that PHP itself imposes a limit on file-uploads. You can find the parameter in the

php.ini
upload_max_filesize


with a default set to 2 megabyte.

Author
VictorManuelVarela


CategoryEN
There are 2 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki