WordPress.org

Support

Support » How-To and Troubleshooting » XML RPC File Upload working but file getting blanked

XML RPC File Upload working but file getting blanked

  • Hi, Firends. I am trying to post with image using XML-RPC. Post done successfully and when i am trying to upload the image its working and responce come like this.

    id102
      fileImage_1358407594.jpg
      urlhttp://localhost/mywordpress/wp-content/uploads/2013/01/Property_1358407594.jpg
      typeimage/jpeg

    Still i am getting courrepted file.
    Here is the code

    function wpUploadFileXMLRPC($blogid,$filepath,$filename,$filetype)
    	{
    		$fs = filesize($filepath);
    		$fh = fopen($filepath, 'rb');
    		$theData = fread($fh, $fs);
    		fclose($fh);
    
    		$data = array(
    		'name'  => $filename,
    		'type'  => $filetype,
    		'bits'  => new IXR_Base64($theData),
    		'overwrite' => false
    		 );
    
    		$params = array($blogid,$this->UserName,$this->PassWord,$data);
    
    		return $this->send_request('metaWeblog.newMediaObject',$params);
    	}

    i tried to search about this and found that this code is correct then why it is not working for me.

    Thanks
    Atul

  • The topic ‘XML RPC File Upload working but file getting blanked’ is closed to new replies.
Skip to toolbar