Upload Image using xmlrpc.php (SCRIPT!)

  • Author
  • #460754


    Does anyone have a script (preferably php) that I can use to upload an image to my wordpress.com blog by calling xmlrpc.php?

    Example: take the image, http://www.desdelahabana.net/wp-content/uploads/2010/03/Sobreviviendo-en-el-socialismo-cubano-168×300.jpg and upload a copy of it to desdeaquifromhere.wordpress.com blog so that I can reference it in a post.

    Note: This is used in our wordpress.com blogs which are translations of Cuban bloggers because we want to preserve the images since they often go away in the original blog. Right now, we just reference the original image in our translated posts but that has resulted in losing images when the original Cuban post is moved or deleted.

    The blog I need help with is desdeaquifromhere.wordpress.com.


    The metaWeblog.newMediaObject will work for uploading files via XML-RPC.



    Thanks…I am looking at the docs for metaWeblog.newMediaObject but am a novice at using XML-RPC. So I understand the function call itself but not the overall way one would use it in a php script.

    Do you perhaps have some example code?


    Using the IXR library that comes with WP it’s pretty easy:

    $data = array(
        'name'  => 'andy.avi',
        'type'  => 'video/x-msvideo',
        'bits'  => new IXR_Base64( dirname( __FILE__ ) . '/MVI_0649.AVI' )
    $rpc = new IXR_Client( $rpc_url );
    $status = $rpc->query(

    You may want to try the WordPress.org support forums as well, there’s nothing specific to WordPress.com in this.



    Many thanks!

The topic ‘Upload Image using xmlrpc.php (SCRIPT!)’ is closed to new replies.