This little issue has been nagging me for a while, this is why I post it here hoping it will help others as well.
So if you want to
- upload images to your own (or somebody else's) MediaWiki
and you
- want to do it using java
and
- you happen to use the Java Wiki Bot Framework (aka jwbf)
then this one is for you:
String localPathToFile = "/home/klausbert/tmp/myTestImage.jpg";
String urlToWiki = "http://mydoma.in/wiki/";
String wikiUser = "klausbert";
String wikiPassword = "klausbertsPassword";
String descriptionText = "Some text to describe the image";
MediaWikiBot mwb = new MediaWikiBot(urlToWiki);
mwb.login(wikiUser, wikiPassword);
SimpleFile file = new SimpleFile(localPathToFile);
file.addText(descriptionText);
mwb.performAction(new FileUpload(file, mwb));
Of course you will need some imports and try-catches. But the code is the essence of what you need to upload the file.
Ӏf yοu аre going fοr beѕt contents like I
AntwortenLöschendo, оnly ѵisit thіѕ ωebѕіte all
the tіme as it offеrs feature cоntents,
thanks
Alsο vіsit my ωeb blog Chemietoilette