Ok, now it works!
It look's like the reason for the error was the url. With a direct link to a file from my appache server I have no problems.
&action=upload
&filename=T2.png
&url=http%3A//localhost/t2.png
&ignorewarnings=1
&token=%2B%5C
&format=xml
Thanks for helping me!
Stephan
________________________________
Von: "stephanheyne-wg(a)yahoo.de" <stephanheyne-wg(a)yahoo.de>
An: MediaWiki API announcements & discussion <mediawiki-api(a)lists.wikimedia.org>
Gesendet: Dienstag, den 11. August 2009, 13:02:41 Uhr
Betreff: [Mediawiki-api] WG: Image upload fails even with example Request
Now I have set the user rights of group all: now its allowed to every user to upload files and upload from url.
So I can absolutly exclude that cause of defect.
________________________________
Von: "stephanheyne-wg(a)yahoo.de" stephanheyne-wg(a)yahoo.de
Ok, even in the trunk the same "fetchfileerror" occures by using a url to upload.
Here are my used post parameters (the line breaks are only for better reading and will not be submitted) :
&action=upload
&filename=Wiki.png
&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png&asyncdownload=true
&token=%2B%5C
&format=xml
I'm not sure what the value of asyncdownload should be: true/false or 1/0.
Naturally the edit token will be be requestet an isn't a constant value.
What's wrong?
Stephan
----- Weitergeleitete Mail ----
Von: "stephanheyne-wg(a)yahoo.de" <stephanheyne-wg(a)yahoo.de>
An: mediawiki-api(a)lists.wikimedia.org
Gesendet: Montag, den 10. August 2009, 12:43:33 Uhr
Betreff: WG: Image upload fails even with example Request
Thanks for the fast answer!
I will try the trunk immediately.
Best regards,
Stephan
Hi all together,
I'm using my own local instance of mediawiki NEW-UPLOAD Branch, but it seems that the action=upload feature of the API didn't work.
By trying to upload a image form a url I got allways the same error:
<error code="An HTTP error occured: " info="fetchfileerror"/>
The error EVEN occures if I use the example from the api.php:
api.php?action=upload&filename=Wiki.png&url=http%3A//upload.wikimedia.org/w…
Of course I appened the token and the format=xml at the end of the request and I'm using POST to submit.
The LocalSettings.php has the Values:
I don't know whats the problem or if it's just don't works in that version. Has someone else that problem or has someone else succsessfully managed to upload a file through the API?
Note: I don't need it but the manuel file upload via Special:Upload page also don't works (the source filename field is empty after clicking on upload file but nothing else happens) maybe there is a relation between the problems?
$wgEnableUploads = true;
$wgAllowCopyUploads = true;
Hello all,
An empty page title is a non-normalized name for 'Main Page' in
mediawiki (except for 'delete' actions). This is most notable in the
interwiki links from 'Main Page':
http://en.wikipedia.org/w/api.php?action=query&prop=langlinks&titles=Main%2…
returns
(...)
<page pageid="15580374" ns="0" title="Main Page">
<langlinks>
<ll lang="ar" xml:space="preserve" />
<ll lang="bg" xml:space="preserve" />
<ll lang="ca" xml:space="preserve" />
<ll lang="cs" xml:space="preserve" />
These links give the correct page when used as interwiki link
([[ar:$1]] resolves to http://ar.wikipedia.org/wiki/$1).
Resolving these pages using the API is impossible, however. It is
possible to ask for an empty title, but this yields
http://en.wikipedia.org/w/api.php?action=query&prop=langlinks&titles=|
(...)
<pages>
<page title="" invalid="" />
</pages>
There are three possible solutions for this:
1) Changing the interwiki links to link to the correct main page
2) Letting the API resolve empty titles
3) Resolving it client-side
All three have their disadvantages:
1) Community outrage; additionally it needs more maintenance. The
current system is pretty fool-proof.
2) The API consistently uses Title:newFromText to resolve the title.
This function is used all over mediawiki, however, so changing it
makes {{}} a valid construct. This changes parser behaviour, which is
(iirc) not acceptable. The alternative would be to add a conditional
for every call to newFromText. Mediawiki normally uses
Wiki::checkInitialQueries to resolve '', but it's not possible to use
that function.
3) Brr. 'Main Page' language tables.
Any ideas on how to solve this effectively?
-Merlijn