Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

UploadPlus

Summary: upload enhancements to organise uploads on a per group or per page base, and more
Version: 2008-04-06
Prerequisites: PmWiki 2.? (tested with 2.2beta65)
Status: new
Maintainer: HansB
Categories: Uploads

Questions answered by this recipe

How can I organise uploaded files in different ways for different groups or pages?
How can I get rid of the Attach: part of a link showing?
How can I have a more readable tabulated format for the attachment filelist?

Description

Enhanced upload script adding capacity to organise uploads on a per group or per page basis

This script adds additional features to the upload capabilities of PmWiki.

  1. It 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, i.e.'Special' group uploads organised in subfolders per page:
    $UploadPrefix['Special'] = '/$Group/$Name';
  2. Attach:filename.ext if shown as link appears without the Attach: part.
  3. Setting $EnableLinkPrefixLabel = 1; will display links with Attach:filename part (default is filename only without prefix label).
  4. File list (:attachlist:) is tabulated (adapted from Cookbook:FileList).

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;.

The script uses a modified tabulated format for the (:attachlist:) markup used to list files attached to a page (or group). This is derived from FileList, but modified to be able to handle the different file locations as defined through the $UploadPrefix array. To make it look best, copy Attach:dot.pngΔ to a pub/images folder.

Usage

Uploadplus works in addition to the PmWiki upload.php script. It redefines action=postupload and action=download and uses a few modified upload core functions, in order to use an $UploadPrefix array instead of the $UploadPrefixFmt variable. The admin can add $UploadPrefix array elements to define upload file prefix 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.

Examples:
  • $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

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See Also

Contributors

Comments

Edit - History - Print - Recent Changes - Search
Page last modified on April 28, 2008, at 09:20 AM