How can i upload image and status both to twitter from client side only .I am using Oauth.io and Phonegap .If somebody know about this please reply me as soon as possible .
Asked
Active
Viewed 1,139 times
1 Answers
0
Take a look at this jsfiddle: http://jsfiddle.net/6Jx84/12/
OAuth.popup("twitter").then(function(result) {
var data = new FormData();
data.append('status', 'This is a test');
data.append('media[]', b64toBlob(logo), 'logo.png');
return result.post('/1.1/statuses/update_with_media.json', {
data: data,
cache:false,
processData: false,
contentType: false
});
}).done(function(data){
//todo once the image is sent
}).fail(function(e){
//todo if an error occured
});
It sends a tweet with the status "This is a test" and with the OAuth.io's logo
It uses the endpoint /1.1/statuses/update_with_media.json
of the Twitter API: https://dev.twitter.com/rest/reference/post/statuses/update_with_media

Thibaud Arnault
- 1,435
- 14
- 21