On Wed, Feb 01, 2012 at 05:22:39PM +0100, Robert Vogel wrote:
Does anybody know if it is possible to upload a base64 encoded file via the API? I've already examined SVGEdit extension by Brion Vibber (http://www.mediawiki.org/wiki/Extension:SVGEdit) to get behind the api file upload magic. But as SVG is just text it doesn't quite fit to my use case.
Since HTTP POSTs may contain binary data, you can send the file without any special encoding. That would usually be the best thing to do.
Theoretically, if you really wanted to base64-encode it you could include a "Content-Transfer-Encoding: base64" header in the MIME part for the file data.[1] But PHP doesn't handle this correctly,[2] so in practice you'll probably need to use 8bit or binary encodings instead.
[1] See RFC 2388 section 3. https://www.rfc-editor.org/rfc/rfc2388.txt [2] https://bugs.php.net/bug.php?id=48219