From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
BWCA Canoe Outing - 001.jpg
Script information
Author ShakataGaNai
Talk Talk
Main page phpmwupper
Language PHP
Version 0.1
Description Batch rename & upload of files to Commons
Licence gpl
Formats supported jpeg, png, gif, bmp


Help Docs
Running the script Main page

What is it?[edit]

I, ShakataGaNai, wanted a batch uploading tool for Commons. While I'd previous used the Perl script, it didn't have the features I wanted. So I did what all half-assed coders do when they've got more time than common sense, I wrote my own (in PHP!). Basically it takes a directory, and a text file of the description, and uploads them under a serial name scheme (EX: "File:Some Longer Name Here - 0001.ext"). Of course after I completed the write, I found Nichalps updated upload script. If you want something more full featured, try his. If you've _got_ to have PHP, try mine.

Nuvola apps important.svg

!!!WARNING!!! -- This software is very very pre-alpha. It has very little in the way of error checking or logging, and has hardly been tested.


  • 'Rename' on the fly
  • Upload


  • Windows (Linux might work - not tested)
  • PHP 5.X

How to Run[edit]

  • Save all 3 files (listed in the infobox) into the same directory
  • In config.php update:
  • Update description.txt
  • Launch a command window
  • cd to where those php scripts are
  • Run: php phpmwupper.php
  • ...
  • Profit?!

Important Information[edit]

The 'UPLOAD_PREFIX' variable gets used to generate the 'final' file names. If you set it to 'A Cool Trip' your final file names will be 'File:A Cool Trip - 0001.ext'. The 0001 number starts at what ever 'START_NUMBER' is set to and is padded by 'PAD_DISTANCE'. The extension is defined by whatever the original file was (but translated into lower case).