eldur / jwbf

Java Wiki Bot Framework is a library to maintain Wikis like Wikipedia based on MediaWiki.
http://jwbf.sourceforge.net/
Apache License 2.0
78 stars 33 forks source link

problem with FileUpload #6

Closed anja1505 closed 10 years ago

anja1505 commented 11 years ago

Hi,

i'm trying to upload an image to my local MediWiki, but it won't work.

Here is the code i wrote:

public class Test { static String localPathToFile = "../MediaWiki_jwbf_Test/img/schaf4.gif"; static String url = "http://localhost/wiki1.20.7/"; static String user = "wikiuser"; static String password = "mypassword"; static String descriptionText = "Schaf";

public static void main (String[]args){
    MediaWikiBot b = new MediaWikiBot(url);
    b.login(user, password);

    SimpleFile file = new SimpleFile(localPathToFile);
    FileUpload fu = new FileUpload(file, b);
    b.performAction(fu);    
}

}

Is there any mistake in the code? The login and creating of a new page in the wiki work correct and $wgEnableUploads in the LocalSettings.php ist set to true. The version of the MediaWiki i work with is 1.20.7 and 1.19.8.

Could you help me with this problem?

eldur commented 10 years ago

Hi Anja,

your test looks okay (related test; line 130 et seq) .. hmm. What version of jwbf are you using?

anja1505 commented 10 years ago

Thanks for your answer!

I'm using jwbf version 2.0.

eldur commented 10 years ago

Sorry, if there is no exception, I would go in debug mode and step through. Check if the upload post is okay and if the file attachment is mapped successfully. It will be also helpful to check you local webserver accesslog too.

Feels like a missing input validation ... If you get it, I would appreciate a pull request :-) :-D