Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用angularjs向twitter上传超过1mb的图像_Angularjs_Twitter_Oauth.io - Fatal编程技术网

使用angularjs向twitter上传超过1mb的图像

使用angularjs向twitter上传超过1mb的图像,angularjs,twitter,oauth.io,Angularjs,Twitter,Oauth.io,我正在尝试做一个网络应用,我需要做一个分享按钮,将上传图像。我正在使用oauth.io作为twitter api。这是控制器的作用域 $scope.shareButton = function(){ var deferred = $q.defer(); OAuth.popup('twitter').then(function(result){ var data = new FormData(); data.app

我正在尝试做一个网络应用,我需要做一个分享按钮,将上传图像。我正在使用oauth.io作为twitter api。这是控制器的作用域

$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
    }
但当我尝试它时,我从控制台得到以下错误:

POST https://oauth.io/request/twitter/%2F1.1%2Fstatuses%2Fupdate_with_media.json 413 (Request Entity Too Large)
所以我在谷歌上搜索发现我们上传的图片不能超过1MB。但我看到一些网站在这样做。所以问题是我怎样才能上传超过1MB的图像。我需要高达5mb的内存

提前谢谢