• Resolved daki-san

    (@daki-san)


    Hi there

    I am running a subdirectory enable WP.

    Using an XMLRPC call to mw_newMediaObject, I can not get uploaded files to land in the media library of the target blog, blog_id 2. The uploaded files always land in the uploads/yyyy/mm folder. And in the media library for that blog too.

    I trace the blog_ID to class-wp-xmlrpc-server.php and it’s definitely receiving the correct value (2) at that point. So, if anybody knows why the uploads are mis-directed from there I’d appreciate your advice.

    Sanity check: the xmlrpc returns a packet containing this data:

    array (
            'id' => '30',
            'file' => 'test2_889047515_2.png',
            'url' => 'http://bidwp/wp-content/uploads/2013/11/test2_889047515_2.png',
            'type' => 'image/png',
          )

    and the htaccess is standard from the WP codex.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    How are you defining the blog ID and upload folder?

    I’m stabbing in the dark at a grue here, mind you….

    Thread Starter daki-san

    (@daki-san)

    blog_ID is passed to the call thus:

    require_once 'IXR_Library.php';
    $client = new IXR_Client('http://my-site.com/xmlrpc.php');
    $params = array('name' => 'test2_889047515_2.png', 'type' => 'image/png', 'bits' => new IXR_Base64($bits), 'overwrite' => false);
    $client->query('wp.uploadFile',2, 'admin', 'password', $params);

    and as mentioned the returned packet is in the previous post.

    Thanks,

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    I’d need to see the whole code to even begin to backtrack through it. Do you have it on GitHub maybe?

    Thread Starter daki-san

    (@daki-san)

    Hi,

    I found the cause in the end. Despite the RPC requiring a blog ID parameter and despite the method itself having a $blog_ID variable, the solution was to call the xmlrpc.php from the sub blog.

    So,

    using mysite.com/xmlrpc.php and passing blog_id 2 // fails
    using mysite.com/sub-blogname/xmlrpc.php // works

    Not documented too well that I could find!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘xmlrpc mw_newMediaObject ignores blog_id’ is closed to new replies.