Media Upload via URL issues


#1

Hello, I’m attempting to implement an Aviary photo editor for images on my buddypress site. The editor plugin creates a new image that i am trying to upload to the current users account but without success. The new image doesnt show up and i dont see any detailed error message in the response. Could you show me what im doing wrong?

$nonce = RTMediaUploadView::upload_nonce_generator ( false,true );
$postURL = "site.com/upload";
$response = wp_remote_post($postURL,array('body'=>array(
  $nonce['action']=>$nonce['nonce'],
  'mode'=>'link_input',
  'context'=>'bp_member',
  'files'=>array('filename'=>$tmp)// $tmp contains full file path on server
)));

print_r($response);


#2

Hello @jdtower,

Try below code:

$nonce = RTMediaUploadView::upload_nonce_generator( false, false );
$postURL = "site.com/upload";
$response = wp_remote_post($postURL, array( 'body' => array(
  $nonce[ 'action' ] => $nonce[ 'nonce' ],
  'mode' => 'url_upload',
  'context' => 'bp_member',
  'url' => $filepath // absolute path to the media
)));

Make sure you have set ‘Allow user to upload media via URL’ to ON.

Thank you.


#3