Last modified: 2009-10-20 21:59:56 UTC
I sent a POST request to https://secure.wikimedia.org/wikipedia/en/w/api.php with the following (relevant) message headers and body; the ****'s indicate where I have obscured or omitted content that shouldn't affect this issue: Content-Type: multipart/form-data boundary="===============0637518620==" MIME-Version: 1.0 --===============0637518620== Content-Type: text/plain MIME-Version: 1.0 Content-disposition: form-data; name="maxlag" 5 --===============0637518620== Content-Type: text/plain MIME-Version: 1.0 Content-disposition: form-data; name="format" json --===============0637518620== Content-Type: text/plain MIME-Version: 1.0 Content-disposition: form-data; name="filename" Testpage1.gif --===============0637518620== Content-Type: text/plain MIME-Version: 1.0 Content-disposition: form-data; name="token" 6e09************************e48a+\ --===============0637518620== Content-Type: image/gif MIME-Version: 1.0 Content-disposition: form-data; name="file" GIF89a2**** lots of 16-bit data deleted ****; --===============0637518620== Content-Type: text/plain MIME-Version: 1.0 Content-disposition: form-data; name="action" upload --===============0637518620==-- The API returned the error message: {"error": {"code": "missingparam", "info": "One of the parameters sessionkey, file, url, enablechunks is required" } } The parameter "file" actually was present in the input, so the error message is inexplicable. Clearly, something is wrong but I cannot tell whether it is in the server or the client.
You're file content-disposition is wrong; it should be like this: 'Content-Disposition: form-data; name="%s"; filename="%s"\r\n'