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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -