Quantcast
Channel: WordPress.com Forums » Recent Topics
Viewing all articles
Browse latest Browse all 74536

cbmono on "Uploads aren't created correctly via XML-RPC (metaWeblog, newMediaObject)"

$
0
0

I'm uploading images via XML-RPC using metaWeblog.newMediaObject
My code seems to work fine, because after the upload I become as answer something like:

array(3) { ["file"]=> string(8) "Aara.jpg" ["url"]=> string(66) "http://myblog.com/wp-content/uploads/2010/09/Aara.jpg" ["type"]=> string(10) "image/jpeg" }

But if I check the uploaded image, it is just a few bytes big and has a size of 0 x 0 pixel. Does anyone knows whats wrong?
This is my code (PHP):


$XmlRpc_result = null;
$XmlRpc_client = new IXR_Client ($data['Blog']['url'].'/xmlrpc.php');

$image = array
(
'name' => 'Aara.jpg',
'type' => 'image/jpeg',
'bits' => new IXR_Base64 (dirname ( __FILE__).'/image.jpg')
);

try
{
$XmlRpc_result = $XmlRpc_client->query
(
'metaWeblog.newMediaObject',
1,
$data['Blog']['wp_user'],
$data['Blog']['wp_pw'],
$image
);

var_dump ($XmlRpc_result);
}
catch (Exception $e)
{
var_dump ( $e->getMessage ());
}

I also tried using the Zend_XmlRpc_Client Class form the Zend Framework, with the same result.
The image I'm uploading is around 80 Kb big and with a size of 600x400 px.

Thanks a lot in advance for any answer.


Viewing all articles
Browse latest Browse all 74536

Trending Articles