* Jeroen De Dauw jeroendedauw@gmail.com [Fri, 18 Feb 2011 00:50:48 +0100]:
Hey,
I have an extension that transfers content, including images, from one wiki to another via the API. Currently it's using the upload via url option [0], which works great, but not obviously not for source wikis that can not be accessed from where the target wiki is. For that I need to use the regular file transfer, but can't find what to do here.
The documentation states very helpful "When uploading files directly, the request must use multipart/form-data as Content-Type or enctype, application/x-www-form-urlencoded will not work.", but then provides
no
clue at how to actually set the content type when making a request via the MWHttpRequest class. I tried several things after looking at the
source,
but could not get it working. Also am not finding any existing code doing this.
Any pointers here would be greatly appreciated :)
[0]
https://secure.wikimedia.org/wikipedia/mediawiki/wiki/API:Upload#Uploading_f...
Cheers
I do use Snoopy php library for multipart/form-data in my Extension:WikiSync. I also use it as a proxy to bypass remote AJAX call security restriction (because my extension was originally used with IE which does not support CORPS and I don't like JSONP and also it's probably unsuitable for posting). Dmitriy