[pmwiki-users] $UploadPrefixFmt and Attach files

Patrick R. Michaud pmichaud at pobox.com
Fri Apr 4 07:28:02 CDT 2008


On Fri, Apr 04, 2008 at 09:52:29AM +0200, Dominique Faure wrote:
> On Thu, Apr 3, 2008 at 5:12 PM, Hans <design5 at softflow.co.uk> wrote:
> >  > I would like to be able to upload in some wiki groups
> >  > so the uploaded files are stored in
> >  > uploads/$Group/$Name/ folders, and in some groups in
> >  > uploads/$Group/ folders.
> >
> >  > How do I configure this, and also have the Attach: markup working,
> >  > so that Attach:{$Name}.jpg  will work in both cases, i.e. an image file
> >  > with the page name as file name will be displayed in the page without
> >  > needing a Group/ or Group/Name part.
> >
> >  > Setting $UploadPrefixFmt  should set the upload path, but it only
> >  > sets it if I also set in config.php
> >
> > [...]
> I've already been trapped there while designing
> http://www.pmwiki.org/wiki/Cookbook/LinkedResourceExtras, and this led
> me to the conclusion that we're hitting there a design flaw or more
> truely an implementation choice dictated for simplicity. 

Thanks.  You're correct, when I implemented the upload feature I went
for simplicity (because that's all I really needed at the time).  And
I've never needed anything significantly more complex so it has pretty 
much stayed the same.

> For now, the attachment handling is only designed to work on a
> wiki-wide basis. Having it working per group or per page is a bit more
> difficult.

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.

Pm



More information about the pmwiki-users mailing list