I'm trying to upload photo to Flickr using Scribe Library, But I've no idea how to use MultipartEntity in Java(I'm new to JAVA). The response from Flickr is: code=93, POST request is too large.
Here's my code, Kindly guide me in right direction.
Bundle extras = data.getExtras();
Bitmap pic = extras.getParcelable("data");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
stream.toByteArray();
pic.compress(Bitmap.CompressFormat.JPEG, 100, stream);
imageView.setImageBitmap(pic);
final OAuthService service = new ServiceBuilder()
.provider(FlickrApi.class)
.apiKey(APIKEY)
.apiSecret(APISECRET).callback(CALLBACK)
.build();
OAuthRequest request = new OAuthRequest(Verb.POST, "http://api.flickr.com/services/upload/");
byte[] img = stream.toByteArray();
MultipartEntity entity = new MultipartEntity();
ContentBody body= new ByteArrayBody(stream.toByteArray(),"pic.jpg");
entity.addPart("photo",body);
request.addPayload(img);
request.addHeader(entity.getContentType().getName(), entity.getContentType().getValue());
service.signRequest(accessToken, request);
Response response = request.send();
String rbody=response.getBody();