Make WordPress Core

Opened 10 years ago

Last modified 5 years ago

#26318 new defect (bug)

XMLRPC wp.uploadFile fails to place media in sub blogs

Reported by: daki-san's profile daki-san Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.7.1
Component: XML-RPC Keywords: needs-codex
Focuses: Cc:


Using an XMLRPC call to mw_newMediaObject, uploaded files do not land in the media library of the target blog, for example blog_id 2. The uploaded files always land in the wp-content/uploads/yyyy/mm folder. And they also appear in the media library for that blog too, via the UI.

If you trace the blog_ID to class-wp-xmlrpc-server.php you can see the method is receiving the correct value (eg. 2) at that point.

This affects (at least) a subdomain-type of installation. The htaccess is standard from the WP codex.

Occurs when blog_ID is passed to the rpc thus:

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

The xmlrpc returns a packet containing this data:

array (
        'id' => '30',
        'file' => 'test2_889047515_2.png',
        'url' => '',
        'type' => 'image/png',

Change History (5)

#1 @markoheijnen
10 years ago

We don't deal with blog IDs. You should always upload to the url of the site

#2 @daki-san
10 years ago

Thanks. That was it all right.

Although if blog IDs are not dealt with, then the docs are out of date.


Upload a media file.

int blogid
string username
string password
struct data


#3 @markoheijnen
10 years ago

Well, they aren't outdated. The first parameter is for that except it's missing that it's still and most likely never will be implemented.

#5 @chriscct7
8 years ago

  • Keywords needs-codex added

Looks like this just need a Codex update

Note: See TracTickets for help on using tickets.