WordPress.org

Ready to get started?Download WordPress

Forums

XML RPC File Upload working but file getting blanked (1 post)

  1. atulkrajput
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic