The SimpleBatchUpload extension provides basic, no-frills uploading of multiple files to MediaWiki.
It is maintained by Professional Wiki. Contact us for commercial support or MediaWiki development.
- PHP 8.0 or later
- MediaWiki 1.43 or later
Use SimpleBatchUpload 2.x for older versions
COMPOSER=composer.local.json composer require --no-update mediawiki/simple-batch-upload:^4.0composer update mediawiki/simple-batch-upload --no-dev -oDownload and place the files in a directory called SimpleBatchUpload in your extensions/ folder.
Enable the extension by adding the following to your LocalSettings.php:
wfLoadExtension( 'SimpleBatchUpload' );See the SimpleBatchUpload usage documentation.
Text on MediaWiki:Batchupload-summary is shown at the top of Special:BatchUpload and its subpages.
It is possible to specify dedicated parameter sets for the upload of specific file types by editing the MediaWiki:Simplebatchupload-parameters page. Each line of that page is considered as one set of parameters.
Available parameters are:
- Name of template to be stored as text on initial upload
- Upload comment
- Title line of the Special:BatchUpload page
Parameters should be separated by pipes (|).
The line to be used is selected by appending the name of the template as the subpage to the URL of the Special:BatchUpload page.
Example:
Consider the parameter line
Pics | These pics were uploaded using [[mw:Extension:SimpleBatchUpload{{!}}SimpleBatchUpload]] | Upload some pics!
- This can be selected by going to Special:BatchUpload/Pics.
- The title of this page will be Upload some pics!.
- The comment for the upload will be These pics were uploaded using [[mw:Extension:SimpleBatchUpload{{!}}SimpleBatchUpload]].
- If a file with that name is uploaded for the first time it will have
{{Pics}}as wikitext. - Both can be changed under Edit details before Upload is pressed: the wikitext as File page text, the comment as Summary.
Select Edit details above the file list; Rename files is in the form it opens. Each row shows the name its file will be uploaded under before Upload is pressed.
| To | Find | Replace with | Use regular expressions | IMG_0001.jpeg uploads as |
|---|---|---|---|---|
| Add a prefix | Trip- |
no | Trip-IMG_0001.jpeg |
|
| Replace text | IMG_ |
Trip- |
no | Trip-0001.jpeg |
| Change the extension | \.jpeg$ |
.jpg |
yes | IMG_0001.jpg |
| Keep part of the name | ^IMG_(\d+) |
Trip-$1 |
yes | Trip-0001.jpeg |
- An empty Find puts Replace with in front of the name.
- Plain text replaces every occurrence, matching case, and never changes the file extension.
- A regular expression searches the whole name, extension included, and
replaces every match. In Replace with,
$1stands for the first(...)group, along with the rest of JavaScript's replacement syntax. - Files that end up sharing a name wait on their rows for a choice.
- A name left without an extension is marked on its row. The file is still sent, and the wiki adds an extension from what the file turns out to be.
A +rename parameter fills in the fields when the page opens, with Use regular
expressions ticked. The uploader can still change them. Here Pics names the
template every uploaded file's page contains:
{{#batchupload:Pics|+rename = /^IMG_(\d+)/-->Trip-$1}}
| Part | In the example | Written as |
|---|---|---|
| Delimiters | / |
#, /, @ or !; use one that is not in the pattern |
| Pattern | ^IMG_(\d+) |
A regular expression |
| Flags | none | Any of g, i, m, u and y, right after the closing delimiter. Without g only the first match is replaced, even after Find or Replace with is edited |
| Replacement | Trip-$1 |
Everything after -->, spaces included |
- A rule containing
|goes inside<nowiki>whole:+rename = <nowiki>/IMG_|DSC_/-->Trip-</nowiki>. - A rule not written this way renames nothing, and the upload area says so.
- The parameter is not passed to the template.
- A parameter line on MediaWiki:Simplebatchupload-parameters cannot set a
rule, and a
+renametyped into File page text is published as written.
{{#batchupload:Pics|+autoupload}}
Files added to this upload area start uploading straight away, without Upload being pressed.
Available configuration options:
$wgSimpleBatchUploadMaxFilesPerBatch- Array defining the maximum number of files that can be uploaded each time depending on the user group.
Default:
$wgSimpleBatchUploadMaxFilesPerBatch = [
'*' => 1000,
];Note: Be aware that this is not the right setting to completely block file uploads! Users can still use the normal file upload or the MediaWiki API. See the paragraph on user permissions on Configuring file uploads on mediawiki.org.
GNU General Public License 2.0 or later