I want to use the rtMedia upload API, I am following this doc “http://docs.rtcamp.com/rtmedia/developer/api/rtmedia-api/endpoints/upload-endpoint/”. I am trying to post the media data programmatically as on defined endpont ‘http://yousite.com/members/username/upload/ (a BuddyPress profile)’. But I am getting a blank response from my ajax request. If I encoded the data into JSON then it will return me the html of the endpont url as in ajax response.
Please check the code below and please let me know at which manners
it will work.
$(document).ready(function(){
var form_data = {};
var files = {};
files['name'] = 'abc.jpg';
files['type'] = 'image/jpeg';
files['tmp_name'] = '<?php echo $img; ?>'; // $img =
files already on the server
/server_path/includes/946968884626505178_1755025174.jpg
files['error'] = 'UPLOAD_ERR_OK';
files['size'] = '';
form_data['mode'] = 'file_upload';
form_data['title'] = 'abc';
form_data['context'] = 'profile';
form_data['context_id'] = '4';
form_data['album_id'] = '1';
form_data['files'] = files;
var fdata;
fdata = JSON.stringify(form_data);
$.ajax({
url:'<?php echo $url; ?>', // $url =
http://sever_url/wpinstagram/members/anku/upload/
type:'Post',
data:form_data,
success:function(response){
alert(response);
return false;
}
});
})