On Sat, Jan 1, 2011 at 6:13 PM, Jan Luca <j...@jans-seite.de> wrote:
> Hi,
>
> I have a problem with the API and following HTTP-request (PHP-Code):
>
> $message =
> "--".$boundary."
> Content-Type: application/x-www-form-urlencoded
>
> ignorewarnings=1&token=".urlencode($token)."&filename=".urlencode($new_file)
> ."&file=".urlencode("file")."&comment=".urlencode($desc)."
>
> --".$boundary."
> Content-Type: application/octet-stream
> Content-Disposition: form-data; name=\"file\"; filename=\"".$new_file."\"
>
> ".$file."
> --".$boundary."--";
>
I have never tried mixing x-www-form-urlencoded with
multipart/form-data. Try encoding each field as their own part in the
multipart blob.

Another tip, always sent the edit token as the last field. If you send
the edit token before the file and your upload gets interrupted half
way, a half uploaded file will appear. PHP does not care about your
Content-Length header...


Bryan

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to