Recent Uploads Log

Summary: List all uploaded files in RecentUploads pages
Version: 2009-09-03
Maintainer: Petko
License: PD

Since 2.3.0, it is possible to easily enable a default RecentUploads format on Site.AllRecentChanges with this line:

  $EnableRecentUploads = 1;

If you need different options, different formats, or having different RecentUploads pages, read on. If you previously used this recipe, it will still work like before.

Questions answered by this recipe

How do I track every uploaded file in the RecentChanges and AllRecentChanges pages and easily review it?


Every uploaded file is logged in the Group.RecentUploads pages with a link from (All)RecentChanges for easy review.

The format of what is printed in the RecentChanges and RecentUploads pages, is defined with the $RecentUploadsFmt variable in config.php. It is the same as $RecentChangesFmt and will be used as an indication where to write the log and what information to include.

Initially, the variable $RecentUploadsFmt is not set. An administrator needs to define it in config.php to enable the logging of uploaded files.

Configuration examples

Currently, the site logs every upload to the page Site.AllRecentChanges with the following command line:

$RecentUploadsFmt['$SiteGroup.AllRecentChanges'] =
    '*[==] [[{$Group}/]] / [[(Path:/pmwiki/uploads/{$Group}/)$upname]]  '
    .'. . . $CurrentTime Uploaded by $AuthorLink to [[{$Group}/{$Name}]] ($upsize $[bytes])';

We have a link [[(Path:/pmwiki/uploads/{$Group}/)$upname]] because we don't enable uploads in all groups, so the Attach: markup wouldn't work. In most cases however, you may use just an Attach: link like [[(Attach:{$Group}.{$Name}/)$upname]].

One could use $RecentUploadsFmt['$SiteGroup.AllRecentUploads'] to log the files to a page named Site.AllRecentUploads instead.

Note: The format that have been documented for a long time had the side effect to insert the group homepages into pagelist trails and into WebFeeds. This was fixed by adding the zero-length escape markup [==] after the first star.

The format used by the standalone recipe in the past, before inclusion to the core, can still be used. For example:

$RecentUploadsFmt['$Group.RecentUploads'] =
  '* [[{$Group}/{$Name}]]/[[(Attach:{$Group}.{$Name}/)$upname]]'
  .'  . . . $CurrentTime $[by] $AuthorLink ($upsize bytes)';

$RecentUploadsFmt['$Group.RecentChanges'] =
  '* [[{$Group}/RecentUploads]]  . . . $CurrentTime $AuthorLink :'
  .' [[{$Group}/{$Name}]]/[[(Attach:{$Group}.{$Name}/)$upname]] ($upsize bytes)';

$RecentUploadsFmt['$SiteGroup.AllRecentChanges'] =
  '* [[{$Group}.RecentUploads]]  . . . $CurrentTime $AuthorLink :'
  .' [[{$Group}/{$Name}]]/[[(Attach:{$Group}.{$Name}/)$upname]] ($upsize bytes)';

This logs every upload to the page Group.RecentUploads, and adds a link to that page both to Group.RecentChanges and Site.AllRecentChanges. Only the latest upload for a Group is displayed in (All)RecentChanges, however, clicking on the link Group.RecentUploads will show you all uploaded files for the Group.

Note that in the current PmWiki core, a page named RecentUploads will be excluded from page lists (with list=normal).


  • The recipe may not work as expected if you have different settings for the $UploadPrefixFmt variable in different pages or groups. For example, if in some group you have per-group uploads, and in another, per-page uploads, it is not possible to cross-link to them from a single page like Site.AllRecentUploads.
  • Only files uploaded after the installation of this recipe will be logged.
  • The older recipe should no longer be used with PmWiki version 2.2.6 and newer. This same functionality was added to the PmWiki core.

    If you are using the old recipe and upgrade to PmWiki 2.2.6 or newer, please uninstall it. Then, to enable the recent uploads as before add to config.php the code shown at the section format used by the standalone recipe above. If you experience any difficulty, contact me (Petko).

Release Notes

See Also



See discussion at RecentUploadsLog-Talk

User notes +4: 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.