Questions answered by this recipe
By default, an attached file (PmWiki.Uploads) is associated with a WikiGroup -- that is, all of the uploads for a particular group are combined in one subdirectory. How can I get uploads to be associated with individual pages or the entire site?
The organization of attachments/uploads is controlled by the
$UploadPrefixFmt variable. By default this variable is set to
"/$Group", which places all attached files into subdirectories by group.
To change this so that attachments are organized on a per-page basis, simply add the following to config.php:
You could also specify that:
Like that you'll get a per-group and per-page basis upload.
To have all of the attachments for an entire site placed into a single location (accessible from all groups), use
- Q: In the V1 Cookbook entry there was a slash between the apostrophes, but that generated a double slash in the rendered URL. Do either of '/$Group/' or '/$PageName/' have this problem? -NHA: Yes, in v2 the trailing slashes are no longer required. I've fixed this above. --Pm
Attach: markup will be affected by these settings:
For default settings with per group uploads (Group uploads folders):
- Link to attachments on the same page ### should this be 'same group'? ### with
- Link to attachments on another WikiGroup with
For per page uploads:
- Link to attachments on the same page with
- Link to attachments on another page with
For uploads in single location:
- Link to attachments on any page with
On 2005-01-05 PM mused about changing the
Attach: markup to allow cross-group references. It would look something like
On 2007-01-08 E.M. I am trying to manage to set up a per group upload site wide password system but only one group per group/page. I have been reading about this but I can't not manage to do this, do you guys know any way to do this ?
Q: How can I determine the current upload directory/url in a recipe (e.g. during markup for a given page)?
A: This worked for me (Frank November 05, 2009, at 08:32 AM):
global $UploadDir, $UploadUrlFmt, $UploadPrefixFmt, $ScriptUrl; $pn = ResolvePageName(''); $upDir = FmtPageName("$UploadDir$UploadPrefixFmt", $pn); $upUrl = FmtPageName("$SkriptUrl$UploadUrlFmt$UploadPrefixFmt", $pn);