UploadPlus
Questions answered by this recipe
How can I organise uploaded files in different ways for different groups or pages?
Description
Enhanced upload script adding capacity to organise uploads on a per group or per page basis
This script allows uploads to be organised by Group and by Group/Name/ subfolders as required for different groups, by setting an array $UploadPrefix, instead of using $UploadPrefixFmt
, eg.'Special' group uploads organised in subfolders per page:
$UploadPrefix['Special'] = '/$Group/$Name';
Installation
Copy uploadplus.phpΔ to cookbook folder and add to config.php:
include_once("$FarmD/cookbook/uploadplus.php");
Make sure uploads are enabled by setting $EnableUpload = 1;
.
Usage
Uploadplus works in addition to the PmWiki upload.php script.
The admin can add $UploadPrefix array elements to define upload file prefixes for groups or pages as needed. The array key needs to be a group name or a full page name (with a dot separator like Group.Name). $UploadPrefix['default']
is used for the sitewide default prefix. The upload prefix is always added to the uploads directory (set by $UploadDir
, default is 'uploads'), before the file name.
$UploadPrefix['Special'] = '/$Group/$Name';
- Files attached to pages in the Special group will be stored in one subdirectory per page.$UploadPrefix['Test.ABC'] = '/Test/ABC001';
- Files attached to Test.ABC will be stored in subdirectory Test/ABC001.$UploadPrefix['default'] = '/$Group/$Name';
- All file attachments will be stored in Group/ Page/ subdirectories of the uploads directory (default is one subdirectory per group).
Notes
Release Notes
- 2009-08-29Δ: minor bugfix
- 2009-08-28: implemented Eemeli Aro's simplified version.
See Also
- File List - Tabulated filelist markup as alternative to
(:attachlist:)
, for a simple, easy readable look.
Contributors
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.