[pmwiki-users] $UploadPrefixFmt and Attach files

Petko Yotov 5ko at 5ko.fr
Sat Apr 5 21:08:58 CDT 2008

On Friday 04 April 2008, Patrick R. Michaud wrote:
> One approach we (I?) could take in this situation would be to generalize
> $UploadPrefixFmt to be an array instead of a single value.  For example,
> we could have:
>     $UploadPrefixFmt = array('/$Group/$Name', '/$Group');
> which says to look in a per-page upload store first, and then
> look in the per-group directory.  Of course, we also need a way
> for ?action=upload to know where to store an attachment (since it
> may be different from one group to the next), but that could be
> handled by introducing a new configuration variable that is set as a
> per-group or per-page customizations.


Could you kindly implement this as separate functions that could be also 
accessed by recipes, instead of authors copying the same snippets? Something 

  # /path/to/file.jpg; existing or to be uploaded/relaced
  $fspath = GetUploadPath($pagename, $filename);

  # this one handles also $EnableDirectDownload
  # and $EnableLinkPageRelative
  $url = GetUploadUrl($pagename, $filename);

This way, PmWiki handles all file locations, whether the file exists or is to 
be uploaded/generated, whether for the same group/page some files were 
uploaded per group, others per page.


More information about the pmwiki-users mailing list