php - wp.uploadFile XML RPC : image size zero -
i trying upload image wordpress xml-rpc:
$dir = getcwd().'/upload/post/'; $thumbnail_img = $post['thumbnail_img']; $mime_type = mime_content_type($dir.$thumbnail_img); $thedata = file_get_contents('http://tf_test.local/upload/post/'.$thumbnail_img); $data = array( 'name'=>'ddd.txt', 'type'=>$mime_type, 'bits'=>new ixr_base64($thedata), 'overwrite' => false ); $client = new ixr_client($media['url'].'xmlrpc.php'); $params = array(0, $media['media_id'], $media['password'], $data); if (!$client->query('wp.uploadfile', $params)) { print ($client->geterrorcode().":".$client->geterrormessage()); } return $client->getresponse();
there no errors, uploaded image size zero!
text files uploaded without problems (ex: log.txt).
Comments
Post a Comment