Topic on Project:Support desk

Bots Uploading images on MW Projects

4
Andrea.bozzano87 (talkcontribs)

Hi everyone,

for my project, i need that my bots could upload images on my wiki. reading the manual, i found that i can use the Upload API for this purpose. To do so, i do a call for APIs with a post request that i send to my MW installation:

action=upload&filename=myfile.png&url=http://url.of.thefile/myfile.png&token=+\

I'm using content type multipart/form-data because i know, from the manual, that application/x-www-form-urlencoded wouldn't work.

The problem is that, even though my Bot is allowed from user group rights to upload files, i cant upload files with it. What did i miss?

Any suggestion would be helpful, thanks for your time and happy development!

110.149.125.240 (talkcontribs)

Why can't you upload files? Is there an error? Since it looks like you're using a URL to upload the file, have you enabled url upload, and given your bot permission?

Andrea.bozzano87 (talkcontribs)

Thank you for your answer,

I'm still working on it, maybe I'll figure out how to upload..

My bot's user group rights grant him to upload files and upload by url, edited in LocalSettings.php, the directory of destination is also writeable by my scripts...

I tried to see the response of my webserver, it just states NULL. Maybe it's some error occurring during connection. The thing is, i'm using the same post request function for login and it works pretty well...

Bawolff (talkcontribs)

multipart/form-data is only required if you are doing a direct upload. It is not required if doing upload by url

Reply to "Bots Uploading images on MW Projects"