1

I am trying to make a web-app and I need to make a share button that will upload an image. I am using oauth.io for twitter-api. Here is the controller scope

$scope.shareButton = function(){
        var deferred = $q.defer();
        OAuth.popup('twitter').then(function(result){
            var data = new FormData();
              data.append('status', 'First thing to try!!!');
              //image is base64 string of the image
              data.append('media[]', b64toBlob(image),'image.png');
              return result.post('/1.1/statuses/update_with_media.json', {
                  data: data,
                  cache:false,
                  processData: false,
                  contentType: false
              });

        }).done(function(data){
            var str = JSON.stringify(data, null, 2);
            $('#result').html("Success\n" + str).show()
        }).fail(function(e){
            var errorTxt = JSON.stringify(e, null, 2)
            $('#result').html("Error\n" + errorTxt).show()
        });
        console.log(deferred.promise)
        return deferred.promise
    }

But when I try it I get this error from console:

POST https://oauth.io/request/twitter/%2F1.1%2Fstatuses%2Fupdate_with_media.json 413 (Request Entity Too Large)

So I googled and found that we can't upload images more than 1 mb. but I saw some sites doing that. So the question and problem is how I will be able to upload image more than 1 mb. I need up to 5mb..

Thanks in advance.

trd3v3lop
  • 323
  • 2
  • 15

0 Answers0