TIP BatchUploadPlugin is not installed on Foswiki.org.

Batch Upload Plugin

Attach multiple files at once by uploading a zip archive

Usage

  • Enable this plugin in LocalSite.cfg or configure - Test:
  • Attach a zip file to a topic
    • If a comment is entered with the zip file, the comment will be assigned to all contained files unless the IMPORTFILECOMMENTS flag below is enabled and the archive contains corresponding file comments (in which case the latter take precedence).
    • Using archive file comments, it is possible to specifiy hide and/or link flags on a file-per-file basis which override those given in the upload form by enabling the FILECOMMENTFLAGS flag below and adding prefixes of the form +h-l (case insensitive, given in arbitrary order, to be separated from the 'main' description by at least one whitespace).

Plugin Settings

Plugin settings are stored as preferences values. You can override the defaults for these preferences in Main.SitePreferences, the WebPreferences topic of the current web, or in individual topics, using the standard 'Set' syntax e.g:
   * Set BATCHUPLOADPLUGIN_ENABLED = 1

Changing them here will have no effect! This allows you to upgrade the plugin without having worry about losing your settings.

Configurable Preferences

Plugin settings are stored as preferences values. To change the setting you need to overwrite them in DefaultPreferences. Changing them here will have no effect! This allows you to upgrade the plugin without having worry about losing your settings.

  • Enabled state - if disabled, does nothing. You will need to overwrite this if you want the plugin enabled anywhere (either in site or per-web)
    • Set BATCHUPLOADPLUGIN_ENABLED = 0
  • File comments in archives will be imported (and override the default comment specified in the upload form)
    • Set BATCHUPLOADPLUGIN_IMPORTFILECOMMENTS = 1
  • File comments in archives may contain prefixes (see above) which override specified default hide and link flags (this flag is independent from the previous one; if it is disabled, existing prefixes will not be stripped from imported comments)
    • Set BATCHUPLOADPLUGIN_FILECOMMENTFLAGS = 1

Conditional Batch Upload

This plugin provides the ability to choose between attaching uploaded zip files, or extracting and attaching the contents. To enable this feature, add the following lines to the skin templates files, just after the hidefile table entry:

  • templates/attach.pattern.tmpl (attachform section):
 <input type="checkbox" class="foswikiCheckbox" id="batchupload" checked name="batchupload" %BATCHUPLOADCHECKBOX% /><label for="batchupload">%MAKETEXT{"Batch upload for zip file"}%</label> <span class="foswikiGrayText">%MAKETEXT{"Extracts and uploads individual file in zip archive."}%</span>
  • templates/attach.tmpl and templates/attach.classic.tmpl (content section):
 <tr>
  <td align="right">
   Batch Upload:
  </td><td>
   <input type="checkbox" name="batchupload" %BATCHUPLOADCHECKBOX% />Extract Files and Attach them to the Topic
  </td>
 </tr>

In addition, use configure to set the $Foswiki::cfg{Plugins}{BatchUploadPlugin}{usercontrol} option to true.

Caveats

  • Contents of nested zips will only be attached partially

Further Development

  • Support nested zips
  • Support interactive modification of hide and link attributes on a file-per-file basis during archive import
  • Support other archive formats (e.g., tar)

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Plugin Files

File: Description:
data/System/BatchUploadPlugin.txt Documentation
lib/Foswiki/Plugins/BatchUploadPlugin.pm Perl module
lib/Foswiki/Plugins/BatchUploadPlugin/Config.spec Configuration Items

Plugin Info

Plugin Author(s): Foswiki:Main.AndrewJones, Foswiki:Main.ArthurClemens, Foswiki:Main.MartinCleaver
Copyright ©: Foswiki:Main.AndrewJones, Foswiki:Main.ArthurClemens, Foswiki:Main.MartinCleaver
License: GPL
Plugin Release: 1.3
Plugin Version: 11345 (2011-04-08)
Change History:  
08 Apr 2011 Foswiki:Main.AndrewJones: v1.3 - Update for Foswiki 1.1 (Foswikitask:Item10227).
11 Nov 2010 Foswiki:Main.PadraigLennon: v1.2 - Update Config.spec to use Extensions not Plugins (Foswikitask:9996).
11 Feb 2010 Foswiki:Main.AndrewJones: v1.1 - Minor doc updates (Foswikitask:Item8467). Thanks to Foswiki:Main.BryanThale.
19 Mar 2009 Foswiki:Main.AndrewJones: v1.0 - Ported to Foswiki; Small code fixes (using Foswiki API); Doc update
09 Jul 2008 TWiki:Main.MarkusUeberall: Added support for zip file comments. All individual files now inherit the hide and link flags in the same way they inherit the comment specified in the upload form.
21 Mar 2007 TWiki:Main.ScottHoge: added usercontrol cfg, to allow global control of upload as in v1.1
20 Feb 2007 TWiki:Main.MartinRothbaum, TWiki:Main.SopanShewale: added option to enable/disable unzip-and-attach behavior via cgi parameter.
23 Dec 2006 TWiki:Main.ArthurClemens: Cleaned up and repackaged. Zipped files are now checked against the TWiki upload filter - for instance php files will get a .txt extension; spaces in zipped filenames will be changed to underscores. If a comment is entered when uploading a zip, the comment text will be assigned to all new attachments. After successful upload you will no longer see an error screen.
31 Oct 2004 TWiki:Main.MartinCleaver - initial version as plugin
09 Apr 2004 TWiki:Main.DiabJerius
17 Nov 2003 TWiki:Main.JohannesMartin
20 Mar 2003 TWiki:Main.RonKellam
16 Aug 2002 TWiki:Main.ThomasWeigert
14 Jan 2002 TWiki:Main.RyanFreebern
30 Oct 2001 TWiki:Main.VitoMiliano
Dependencies:
NameVersionDescription
Archive::Zip>=1.18Required.
Plugin Home: http://foswiki.org/Extensions/BatchUploadPlugin
Support: http://foswiki.org/Support/BatchUploadPlugin

Related Topics: DefaultPreferences, SitePreferences, Plugins
I Attachment Action Size Date Who Comment
BatchUploadPlugin.md5md5 BatchUploadPlugin.md5 manage 174 bytes 08 Apr 2011 - 17:22 AndrewJones  
BatchUploadPlugin.sha1sha1 BatchUploadPlugin.sha1 manage 198 bytes 08 Apr 2011 - 17:22 AndrewJones  
BatchUploadPlugin.tgztgz BatchUploadPlugin.tgz manage 8 K 08 Apr 2011 - 17:22 AndrewJones  
BatchUploadPlugin.zipzip BatchUploadPlugin.zip manage 10 K 08 Apr 2011 - 17:22 AndrewJones  
BatchUploadPlugin_installerEXT BatchUploadPlugin_installer manage 4 K 08 Apr 2011 - 17:22 AndrewJones  
Topic revision: r7 - 21 Jul 2011, DieterLeichtle
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy