我正在尝试制作一个网络应用程序,我需要制作一个将上传图像的共享按钮。我将 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)
所以我用谷歌搜索,发现我们不能上传超过 1 mb 的图像。但我看到一些网站这样做。所以问题和问题是我如何能够上传超过 1 mb 的图像。我需要高达 5mb ..
提前致谢。