API talk:Import

2014-04-11 Example of code to import xml into wiki using api import
I spent a lot of time and can not figure out the right code to import wiki text into wiki. (Previously I exported this wiki text from wiki.) I try to use Ajax POST request with xhr.setRequestHeader('Content-Type', 'multipart/form-data; ... and get errors like the following
 * "".
 *  

Please, could somebody give ANY working PHP (and/or Ajax and/or HTML) code that uses mediawiki api "import function". Thanks in advance. Roman (t3531350@yahoo.com)

Answer to the question (working code): Загрузить XML-данные    

2013-09-19
 
 * Is this really only for Version 1.15?
 * How would an import via API work in 1.20 or up?
 * How to handle the following error?

workaround
in import.php: static function newFromUpload( $fieldname = "xmlimport" ) { // instead of: $upload =& $_FILES[$fieldname]; $upload= reset($_FILES); somehow the $_FILES array does not have it's index by name any more at this point. $_FILES["xml"] is not found. With a dummy api.php it can be shown that $_FILES has the correct setting in the POST initially: 