I'm attempting to upload files to my wiki by way of the API. I'm using version 1.16 beta 3 installed on a CentOS VPS. I am using the API on my mac using OS X. Here is my command:
curl -b cookies.txt -F token="359d6add9d7d2d7f61c0e47e872d932b+\" -F filename="Test.txt" -F "file=whatever" " http://www.domain.com/w/api.php?action=upload"
If the token is incorrect, I get the appropriate bad token message. But when it's correct, I get this bizarre response:
<span style="color:blue;"><error code="missingparam" info="One of the parameters sessionkey, file, url is required" xml:space="preserve"></span>
Moreover, if I use this command:
curl -b cookies.txt -F token="359d6add9d7d2d7f61c0e47e872d932b+\" -F filename="Test.txt" -F file="@filename" " http://www.domain.com/w/api.php?action=upload"
I get this even more bizarre response:
<span style="color:blue;"><error code="internal_api_error_MWException" info="Exception Caught: Internal error in ApiResult::setIndexedTagName: Bad parameter" xml:space="preserve"></span>
Does anyone have any suggestions?
Thanks, Douglas
On Thu, Jun 24, 2010 at 3:36 PM, Douglas Mason douglasmason@gmail.com wrote:
curl -b cookies.txt -F token="359d6add9d7d2d7f61c0e47e872d932b+\" -F filename="Test.txt" -F "file=whatever" " http://www.domain.com/w/api.php?action=upload"
[...]
<span style="color:blue;"><error code="missingparam" info="One of the parameters sessionkey, file, url is required" xml:space="preserve"></span>
Does curl send the file in multipart/form-data format?
<span style="color:blue;"><error code="internal_api_error_MWException" info="Exception Caught: Internal error in ApiResult::setIndexedTagName: Bad parameter" xml:space="preserve"></span>
That is definitely a bug. I will look into it when I have time.
Bryan
mediawiki-l@lists.wikimedia.org